-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGameseachnumer.java
More file actions
36 lines (31 loc) · 885 Bytes
/
Gameseachnumer.java
File metadata and controls
36 lines (31 loc) · 885 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
33
34
35
36
package com.company;
import java.util.Scanner;
public class Gameseachnumer {
public int a,b;
final int MAX=100;
final int MIN=1;
public void Game(){
while (a!=b)
{
System.out.println("Your number (1:100) :");
Scanner input=new Scanner(System.in);
b=input.nextInt();
if (a>b)
{
System.out.println("Less than!!!");
}
else if (a<b)System.out.println("Greater than!!!");
else
{
System.out.println("!!!!!! Congratulation !!!!");
break;
}
}
}
public static void main(String[] args) {
Gameseachnumer test1=new Gameseachnumer();
test1.a=(int)(Math.random()*(test1.MAX-test1.MIN)+1);
// System.out.println(test1.a);
test1.Game();
}
}