Guest User

Untitled

a guest
Nov 15th, 2018
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.91 KB | None | 0 0
  1. Random rand = new Random();
  2. int minA;
  3. int maxA;
  4. int minB;
  5. int maxB;
  6. int usersAnswer;
  7.  
  8. Console.WriteLine("what is the minimum value: ");
  9. Int32.TryParse(Console.WriteLine(), out minA);
  10.  
  11. Console.WriteLine("what is the minimum value: ");
  12. Int32.TryParse(Console.WriteLine(), out maxA);
  13.  
  14. Console.WriteLine("what is the minimum value: ");
  15. Int32.TryParse(Console.WriteLine(), out minB);
  16.  
  17. Console.WriteLine("what is the minimum value: ");
  18. Int32.TryParse(Console.WriteLine(), out maxB);
  19.  
  20. Console.WriteLine("What is the result of {0} % {1}? ", rand.Next(minA, maxA), rand.Next(minB, maxB));
  21. Int32.TryParse(Console.ReadLine(), out usersAnswer);
  22. answer = //directly implementing the random numbers generated with modulous operator)
  23. if(userAnswer == answer)
  24. {
  25. Console.WriteLine("{0} is correct", answer);
  26. }
  27. else
  28. {
  29. Console.WriteLine("Good try, but no: {the random number} % {the other random number} = {0}", not sure, not sure, answer)
  30. }
Add Comment
Please, Sign In to add comment