Guest User

Untitled

a guest
Apr 25th, 2018
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.78 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace predavanje_4
  8. {
  9. class Program
  10. {
  11. static void Main(string[] args)
  12. {
  13. // MAIN MENU
  14. Beginning:
  15. Console.WriteLine("What do you want to do? \n1. All operations \n2. Circle diameter \n3. Speed \n4. Rectangle fun. \n5. It's getting hot in here \n6. Quit\n");
  16. int mm = Convert.ToInt32(Console.ReadLine());
  17.  
  18. while (mm != 6)
  19. {
  20.  
  21. // ALL OPERATIONS
  22. if (mm == 1)
  23. {
  24. Console.WriteLine("Enter two numbers and I'll do everything for you");
  25. Console.WriteLine("First number");
  26. int a = Convert.ToInt32(Console.ReadLine());
  27. Console.WriteLine("Second number");
  28. int b = Convert.ToInt32(Console.ReadLine());
  29. Console.WriteLine("Their sum is: {0}", a + b);
  30. Console.WriteLine("Their difference is {0}: ", a - b);
  31. Console.WriteLine("Their multiplier is {0}: ", a * b);
  32. Console.WriteLine("Their divide is: {0}\n ", a / b);
  33. goto Beginning;
  34. }
  35. // DIAMETER AND AREA OF A CIRCLE
  36. if (mm == 2)
  37. {
  38. Console.WriteLine("Let's do something a bit round");
  39. Console.WriteLine("What is it's radius?");
  40.  
  41.  
  42. const double pi = 3.14159265359;
  43. int r = Convert.ToInt32(Console.ReadLine());
  44. Console.WriteLine("It's circumference is: {0}", 2 * pi * r);
  45. Console.WriteLine("It's circumference is: {0}\n", pi * r * r);
  46. goto Beginning;
  47. }
  48.  
  49. // SPEED AND TRAVELLED AMOUNT
  50. if (mm == 3)
  51. {
  52. Console.WriteLine("Let's see how fast you are");
  53. Console.WriteLine("How fast are you in km/h?");
  54. int v = Convert.ToInt32(Console.ReadLine());
  55. Console.WriteLine("How many hours have passed?");
  56. int t = Convert.ToInt32(Console.ReadLine());
  57. Console.WriteLine("You have travelled {0} kilometers\n", v * t);
  58. goto Beginning;
  59. }
  60.  
  61. // RECTANGLE
  62. if (mm == 4)
  63. {
  64. Console.WriteLine("Rectangle fun!");
  65. Console.WriteLine("Side a?");
  66. int sidea = Convert.ToInt32(Console.ReadLine());
  67. Console.WriteLine("Side b?");
  68. int sideb = Convert.ToInt32(Console.ReadLine());
  69. Console.WriteLine("It's diagonal is {0}.\nIt's area is {1}. \nIt's cirfumference is {2}\n", Math.Sqrt(sidea * sidea+sideb*sideb), sidea*sideb, 2*sidea + 2*sideb);
  70. goto Beginning;
  71. }
  72.  
  73. // CELSIUS AND FAHRENHEIT
  74. if (mm == 5)
  75. {
  76. Console.WriteLine("Do want:\n1. C to F\n2. F to C");
  77. int cfchoice = Convert.ToInt32(Console.ReadLine());
  78. Console.WriteLine("Enter the temperature");
  79. int temp = Convert.ToInt32(Console.ReadLine());
  80.  
  81. if (cfchoice == 1)
  82. {
  83. Console.WriteLine("{0} C is {1} F\n", temp, temp * 9 / 5 + 32);
  84.  
  85. }
  86. if (cfchoice == 2)
  87. {
  88. Console.WriteLine("{0} K is {1} C\n", temp, (temp-32)*5/9);
  89.  
  90. }
  91. goto Beginning;
  92.  
  93. }
  94.  
  95. }
  96. }
  97. }
  98. }
Add Comment
Please, Sign In to add comment