-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patharray.java
More file actions
32 lines (23 loc) · 740 Bytes
/
array.java
File metadata and controls
32 lines (23 loc) · 740 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
28
29
30
31
32
import java.util.Random;
import java.util.Scanner;
public class array {
public static void main(String[] args) {
Random rand = new Random();
int num=rand.nextInt(100);
Scanner sc = new Scanner(System.in);
System.out.println("Guessed number = "+num);
int lottery=-20;
while(num!=lottery)
{
lottery=sc.nextInt();
if(num==lottery) {
System.out.println("You winn");
System.out.println("Bye bye");}
if(num<lottery) {
System.out.println("Your number is greater ");
} else if(num>lottery) {
System.out.println("Your number is less");
}
}
}
}