Skip to content

Instantly share code, notes, and snippets.

@Fhernd
Created July 29, 2014 03:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Fhernd/1c79c8563d2d229230e8 to your computer and use it in GitHub Desktop.
Save Fhernd/1c79c8563d2d229230e8 to your computer and use it in GitHub Desktop.
Demostración del uso de la excepción DivideByZeroException en C#.
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