fork download
  1. using System;
  2.  
  3. namespace Test05
  4. {
  5. class MainClass
  6. {
  7. public static void Main (string[] args)
  8. {
  9. Start:
  10.  
  11.  
  12. Random numberGenerator = new Random ();
  13.  
  14. int num01 = numberGenerator.Next(2);
  15. int num02 = numberGenerator.Next(0,10);
  16.  
  17. Console.WriteLine ("How much do u pay? (It's 2.00$)");
  18.  
  19. int answer = Convert.ToInt32 (Console.ReadLine ());
  20.  
  21. if (answer == num01) {
  22. Console.WriteLine ("You are free to go!");
  23. } else if (answer > num01) {
  24. Console.WriteLine ("Here's your change. (" + (answer - num01) + ")");
  25. } else {
  26. Console.WriteLine ("That's not enough! You need " + (num01 - answer )+ "more!");
  27. Console.ReadKey ();
  28. goto Start;
  29. }
  30. }
  31. }
  32. }
Success #stdin #stdout 0.05s 24024KB
stdin
-1
5
stdout
How much do u pay? (It's 2.00$)
That's not enough! You need 1more!
How much do u pay? (It's 2.00$)
Here's your change. (4)