Created
July 29, 2014 03:20
-
-
Save Fhernd/1c79c8563d2d229230e8 to your computer and use it in GitHub Desktop.
Demostración del uso de la excepción DivideByZeroException en C#.
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.Excepciones.Parte5 | |
{ | |
public sealed class UsoDivideByZeroException | |
{ | |
public static void Main() | |
{ | |
int dividendo = 13; | |
int divisor = 0; | |
try | |
{ | |
Console.WriteLine ("{0}/{1}", (dividendo/divisor)); | |
} | |
catch (DivideByZeroException) | |
{ | |
Console.WriteLine ("Error: Intento de división entre cero."); | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment