-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathloop_with_questionaire.java
More file actions
43 lines (37 loc) · 1.4 KB
/
Copy pathloop_with_questionaire.java
File metadata and controls
43 lines (37 loc) · 1.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
// ____ ____ _ ____ _____ _ _ ____ _____ _ _ _____ ____
//| _ \/ ___| / \ / ___|_ _| | | | _ \| ____| \ | |_ _/ ___|
//| | | \___ \ / _ \ \___ \ | | | | | | | | | _| | \| | | | \___ \
//| |_| |___) / ___ \ ___) || | | |_| | |_| | |___| |\ | | | ___) |
//|____/|____/_/ \_\ |____/ |_| \___/|____/|_____|_| \_| |_| |____/
// ____ ___ ____ ___ ____ ___
// / ___|/ _ \ / ___|/ _ \ / ___|/ _ \
//| | _| | | | | _| | | | | _| | | |
//| |_| | |_| | |_| | |_| | |_| | |_| |
// \____|\___/ \____|\___/ \____|\___/
import java.util.Scanner;
public class loop_with_questionaire {
private static int questionopperand() {
boolean is_wrong = true;
int user_answer;
int answer = 9981 * 712 / 89 + 14;
System.out.println(" what is 9981 * 712 / 89 + 14??");
Scanner user_input = new Scanner(System.in);
user_answer = user_input.nextInt();
while (is_wrong) {
if (user_answer != answer) {
System.out.println("wrong answer!");
user_answer = user_input.nextInt();
} else {
System.out.println("hooray! correct");
user_input.close();
is_wrong = false;
System.exit(0);
}
}
return 0;
}
public static void main(String[] args) {
questionopperand();
System.exit(0);
}
}