Guest User

Untitled

a guest
Feb 22nd, 2018
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.63 KB | None | 0 0
  1. class Program
  2. {
  3. static void Main(string[] args)
  4. {
  5. double varrr = Divide(10, 0);
  6. }
  7.  
  8. static double Divide(double a, double b)
  9. {
  10. double c = 0;
  11. try
  12. {
  13. c = a / b;
  14. return c;
  15. }
  16. catch (DivideByZeroException)
  17. {
  18. Console.WriteLine("Division by zero not allowed");
  19. return 0;
  20. }
  21. }
  22.  
  23. }
  24.  
  25. static double Divide(int a, int b)
  26. {
  27. int c = 0;
  28. try
  29. {
  30. c = a / b;
  31. return c;
  32. }
  33. catch (DivideByZeroException)
  34. {
  35. Console.WriteLine("Division by zero not allowed");
  36. return 0;
  37. }
  38. }
Add Comment
Please, Sign In to add comment