fork(3) download
  1. using System;
  2.  
  3. namespace Articulos.Cap04
  4. {
  5. public sealed class SinControlExcepciones
  6. {
  7. public static int Dividir (int a, int b)
  8. {
  9. // La expresión `a / b` es propensa a generar la
  10. // excepción de división entre cero:
  11. return a / b;
  12. }
  13.  
  14. public static void Main()
  15. {
  16. int num1 = 7;
  17. int num2 = 0;
  18.  
  19. Console.WriteLine ("\nLa división de {0} entre {1} es igual a {2}\n", num1, num2, Dividir(num1, num2));
  20. }
  21. }
  22. }
Runtime error #stdin #stdout #stderr 0.02s 36344KB
stdin
Standard input is empty
stdout
Standard output is empty
stderr
Unhandled Exception: System.DivideByZeroException: Division by zero
  at Articulos.Cap04.SinControlExcepciones.Main () [0x00000] in <filename unknown>:0 
[ERROR] FATAL UNHANDLED EXCEPTION: System.DivideByZeroException: Division by zero
  at Articulos.Cap04.SinControlExcepciones.Main () [0x00000] in <filename unknown>:0