Advertisement
Uriel133

All3

Feb 15th, 2019
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.92 KB | None | 0 0
  1. // 4
  2. Console.WriteLine("Enter 2 numbers");
  3. int x = int.Parse(Console.ReadLine());
  4. int y = int.Parse(Console.ReadLine());
  5. int d = x % y;
  6. if (d == 0)
  7. {
  8. Console.WriteLine(x + " divides " + y);
  9. }
  10. else
  11. {
  12. Console.WriteLine(x + " not divides " + y);
  13. }
  14.  
  15. // 5
  16. Console.WriteLine("Enter a number, operator and number");
  17. int x = int.Parse(Console.ReadLine());
  18. char c = char.Parse(Console.ReadLine());
  19. int y = int.Parse(Console.ReadLine());
  20. if (c == '+')
  21. {
  22. Console.WriteLine(x + y);
  23. }
  24. if (c == '*')
  25. {
  26. Console.WriteLine(x * y);
  27. }
  28. if (c == '-')
  29. {
  30. Console.WriteLine(x - y);
  31. }
  32. if (c == '/' && y == 0)
  33. {
  34. Console.WriteLine("Error");
  35. }
  36. if (c == '/')
  37. {
  38. Console.WriteLine(x / y);
  39. }
  40.  
  41. // 6
  42.  Console.WriteLine("Welcome to the bar, enter your age");
  43. int age = int.Parse(Console.ReadLine());
  44. if (age < 18)
  45. {
  46. Console.WriteLine("Sorry");
  47. }
  48. else
  49. {
  50. Console.WriteLine("Great. choose 'b' for beer, 'w' for wine");
  51. char c = char.Parse(Console.ReadLine());
  52. if (c == 'b')
  53. {
  54. Console.WriteLine("Your beer is ready");
  55. }
  56. if (c == 'w')
  57. {
  58. Console.WriteLine("Your wine is ready");
  59. }
  60.  
  61. // 7
  62. Console.WriteLine("Enter heart rate");
  63. int hr = int.Parse(Console.ReadLine());
  64. Console.WriteLine("Enter week");
  65. int wk = int.Parse(Console.ReadLine());
  66. if (wk >= 1 && wk <= 2)
  67. {
  68. if (hr <= 60)
  69. {
  70. Console.WriteLine("You need to run 3 km");
  71. }
  72. if (hr >= 61 && hr <= 70)
  73. {
  74. Console.WriteLine("You need to run 3 km");
  75. }
  76. if (hr > 71)
  77. {
  78. Console.WriteLine("You need to run 3 km");
  79. }
  80. }
  81. if (wk >= 3 && wk <= 4)
  82. {
  83. if (hr <= 60)
  84. {
  85. Console.WriteLine("You need to run 5 km");
  86. }
  87. if (hr >= 61 && hr <= 70)
  88. {
  89. Console.WriteLine("You need to run 5 km");
  90. }
  91. if (hr > 71)
  92. {
  93. Console.WriteLine("You need to run 3 km");
  94. }
  95. }
  96. if (wk >= 5)
  97. {
  98. if (hr <= 60)
  99. {
  100. Console.WriteLine("Tou need to run 10 km");
  101. }
  102. if (hr >= 61 && hr <= 70)
  103. {
  104. Console.WriteLine("You need to run 8 km");
  105. }
  106. if (hr > 71)
  107. {
  108. Console.WriteLine("You need to run 3 km");
  109. }
  110. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement