File tree Expand file tree Collapse file tree 1 file changed +43
-0
lines changed Expand file tree Collapse file tree 1 file changed +43
-0
lines changed Original file line number Diff line number Diff line change
1
+ import java .util .Random ;
2
+ import java .util .Scanner ;
3
+ class Guess
4
+ {
5
+ public static void main ()
6
+ {
7
+ System .out .println ("###############" +" " +"MATHEMATICS QUIZ" +" " +"###############" );
8
+ int score ,a ,b ,c ;
9
+ score =0 ;
10
+ Random rg =new Random (System .currentTimeMillis ());
11
+ Scanner d =new Scanner (System .in );
12
+ for (int x =1 ;x <=10 ;x ++)
13
+ {
14
+ System .out .println ("QUESTION" +" " +x );
15
+ a =rg .nextInt (39 );
16
+ b =rg .nextInt (100 );
17
+ System .out .println (a +"+" +b +"=" +"__" );
18
+ c =d .nextInt ();
19
+
20
+ if (a +b ==c )
21
+ {
22
+ score ++;
23
+ System .out .println ("Correct Answer" );
24
+ System .out .println ("Score:" +" " +score );
25
+
26
+ }
27
+ else
28
+ {
29
+ System .out .println ("Incorrect Answer" );
30
+ System .out .println ("Score:" +" " +score );
31
+ }
32
+
33
+ }
34
+
35
+ System .out .println ("Total Score" +"=" +score );
36
+ System .out .println ("Thanks for playing this game" );
37
+ }
38
+ }
39
+
40
+
41
+
42
+
43
+
You can’t perform that action at this time.
0 commit comments