Advertisement
Guest User

Untitled

a guest
Nov 12th, 2019
147
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.06 KB | None | 0 0
  1. using System;
  2.  
  3. namespace PD3zad2
  4. {
  5. public class Program
  6. {
  7.  
  8. static void Main(string[] args)
  9. {
  10. Console.WriteLine("Jakie działanie chcesz wykonać?");
  11. int choose = 0, a = 0, b = 0;
  12. double c = 0;
  13. while (choose != 5)
  14. {
  15. Console.WriteLine("1. Dodawanie");
  16. Console.WriteLine("2. Odejmowanie");
  17. Console.WriteLine("3. Mnożenie");
  18. Console.WriteLine("4. Dzielenie");
  19. Console.WriteLine("5. Wyjscie");
  20.  
  21. choose = Convert.ToInt32(Console.ReadLine());
  22. switch (choose)
  23. {
  24. case 1:
  25. {
  26. Console.WriteLine("Podaj 1 liczbe: ");
  27. a = Convert.ToInt32(Console.ReadLine());
  28. Console.WriteLine("Podaj 2 liczbe: ");
  29. b = Convert.ToInt32(Console.ReadLine());
  30. c = a + b;
  31. Console.WriteLine(c);
  32. break;
  33. }
  34. case 2:
  35. {
  36. Console.WriteLine("Podaj 1 liczbe: ");
  37. a = Convert.ToInt32(Console.ReadLine());
  38. Console.WriteLine("Podaj 2 liczbe: ");
  39. b = Convert.ToInt32(Console.ReadLine());
  40. c = a - b;
  41. Console.WriteLine(c);
  42. break;
  43. }
  44. case 3:
  45. {
  46. Console.WriteLine("Podaj 1 liczbe: ");
  47. a = Convert.ToInt32(Console.ReadLine());
  48. Console.WriteLine("Podaj 2 liczbe: ");
  49. b = Convert.ToInt32(Console.ReadLine());
  50. c = a * b;
  51. Console.WriteLine(c);
  52. break;
  53. }
  54. case 4:
  55. {
  56. Console.WriteLine("Podaj 1 liczbe: ");
  57. a = Convert.ToInt32(Console.ReadLine());
  58. Console.WriteLine("Podaj 2 liczbe: ");
  59. b = Convert.ToInt32(Console.ReadLine());
  60. c = a / b;
  61. Console.WriteLine(c);
  62. break;
  63. }
  64. case 5:
  65. {
  66. Environment.Exit(0);
  67. break;
  68. }
  69. default:
  70. {
  71. Console.WriteLine("Wybrana opcja jest nie poprawna. Proszę wybrać znak od 1 do 5 w zależności co chce się wykonać");
  72. break;
  73. }
  74. }
  75.  
  76.  
  77.  
  78. }
  79. }
  80. }
  81. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement