Advertisement
Fhernd

UsoDivideByZeroException.cs

Jul 28th, 2014
4,538
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.52 KB | None | 0 0
  1. using System;
  2.  
  3. namespace Articulos.Cap04.Excepciones.Parte5
  4. {
  5.     public sealed class UsoDivideByZeroException
  6.     {
  7.         public static void Main()
  8.         {
  9.             int dividendo = 13;
  10.             int divisor = 0;
  11.            
  12.             try
  13.             {
  14.                 Console.WriteLine ("{0}/{1}", (dividendo/divisor));
  15.             }
  16.             catch (DivideByZeroException)
  17.             {
  18.                 Console.WriteLine ("Error: Intento de división entre cero.");
  19.             }
  20.         }
  21.     }
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement