Guest User

Untitled

a guest
Oct 21st, 2018
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.47 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class testClass
  4. {
  5. public static void main (String[] args)
  6. {
  7. boolean loop = true;
  8. int num1 = (int) (Math.random() * (500));
  9. int num2 = (int) (Math.random() * (500));
  10.  
  11. System.out.println("What's "+num1+" + "+num2+"?");
  12.  
  13. while(loop)
  14. {
  15. Scanner scan = new Scanner(System.in);
  16. int input = scan.nextInt();
  17.  
  18. if (input==(num1+num2))
  19. {
  20. System.out.print("Correct answer!");
  21. loop = false;
  22. }
  23. }
  24. }
  25. }
Add Comment
Please, Sign In to add comment