-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmini.java
More file actions
27 lines (25 loc) · 790 Bytes
/
mini.java
File metadata and controls
27 lines (25 loc) · 790 Bytes
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
import java.util.Scanner;
public class mini {
public static void main(String[] args) {
Scanner sc= new Scanner(System.in);
int num=(int)(Math.random()*10);
int usernum=0;
do{
System.out.println("Guess my number (0-10)");
usernum= sc.nextInt();
if(usernum == num){
System.out.println("WOOHOO .. CORRECT NUMBER");
break ;
}
else if(usernum > num){
System.out.println("Your Number is Large");
}
else{
System.out.println("Your number is Small");
}
}
while (usernum >= 0);
System.out.println("MY number was :");
System.out.println(num);
}
}