Advertisement
Guest User

Untitled

a guest
Oct 19th, 2018
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.88 KB | None | 0 0
  1. static void Main(string[] args)
  2. {
  3. int a = 0;
  4. int b = 0;
  5. Console.WriteLine("Podaj liczbę");
  6. // a = Convert.ToInt32(Console.ReadLine());
  7.  
  8. try
  9. {
  10. a = Convert.ToInt32(Console.ReadLine());
  11. }
  12. catch (Exception)
  13. {
  14. Console.WriteLine("Nie podałes liczby");
  15. }
  16.  
  17. int c;
  18.  
  19.  
  20. b = 0;
  21.  
  22.  
  23. try
  24. {
  25. c = a / b;
  26. }
  27. catch (ArithmeticException)
  28. {
  29. Console.WriteLine("Błąd");
  30. Console.ReadLine();
  31. }
  32. /* catch (Exception)
  33. {
  34. Console.WriteLine("Błąd nr 2");
  35. Console.ReadLine();
  36. }
  37. */
  38. }
  39. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement