Advertisement
Guest User

Untitled

a guest
May 22nd, 2015
190
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.02 KB | None | 0 0
  1. using System;
  2.  
  3. namespace test111
  4. {
  5. class MainClass
  6. {
  7. public static void Main (string[] args)
  8.  
  9. {start:
  10.  
  11. Random ng = new Random ();
  12. float num1 = ng.Next (1,11) ;
  13. float num2 = ng.Next (1,11);
  14. double num3;
  15.  
  16. int responseIndex = ng.Next (1, 5);
  17. switch (responseIndex){
  18.  
  19. case 1:
  20.  
  21. Console.WriteLine("what is " + num1 + " times " + num2);
  22. num3 = Convert.ToDouble (Console.ReadLine ());
  23.  
  24. if (num3 == num1 * num2)
  25. {
  26. Console.WriteLine ("you are correct, good job!!!");
  27. goto start;
  28. }
  29. else
  30. {
  31. Console.WriteLine ("nice try but you are incorrect!!!");
  32. goto start;
  33.  
  34. case 2:
  35.  
  36. Console.WriteLine("what is " + num1 + " divide " + num2);
  37. num3 = Convert.ToDouble (Console.ReadLine ());
  38.  
  39. if (num3 == num1 / num2)
  40. {
  41. Console.WriteLine ("you are correct, good job!!!");
  42. goto start;
  43. }
  44. else
  45. {
  46. Console.WriteLine ("nice try but you are incorrect!!!");
  47. goto start;
  48. }
  49. }
  50.  
  51.  
  52. }
  53. }
  54. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement