Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class testClass
- {
- public static void main (String[] args)
- {
- boolean loop = true;
- int num1 = (int) (Math.random() * (500));
- int num2 = (int) (Math.random() * (500));
- System.out.println("What's "+num1+" + "+num2+"?");
- while(loop)
- {
- Scanner scan = new Scanner(System.in);
- int input = scan.nextInt();
- if (input==(num1+num2))
- {
- System.out.print("Correct answer!");
- loop = false;
- }
- }
- }
- }
Add Comment
Please, Sign In to add comment