Created
June 20, 2014 18:26
-
-
Save Fhernd/b64977c112f76b66b9ce to your computer and use it in GitHub Desktop.
Método Dividir sin control de excepciones.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
namespace Articulos.Cap04 | |
{ | |
public sealed class SinControlExcepciones | |
{ | |
public static int Dividir (int a, int b) | |
{ | |
// La expresión `a / b` es propensa a generar la | |
// excepción de división entre cero: | |
return a / b; | |
} | |
public static void Main() | |
{ | |
int num1 = 7; | |
int num2 = 0; | |
Console.WriteLine ("\nLa división de {0} entre {1} es igual a {2}\n", num1, num2, Dividir(num1, num2)); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment