-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathWordgame.java
More file actions
36 lines (33 loc) · 798 Bytes
/
Wordgame.java
File metadata and controls
36 lines (33 loc) · 798 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
import java.util.Scanner;
class Wordgame
{
public static void main(String[] args)
{
Scanner scan = new Scanner(System.in);
int secretNumber = 37;
int userGuess = -1;
// System.out.println("What is a number bettween 1 and 100");
// userGuess = scan.nextInt();
while(userGuess != secretNumber)
{
System.out.println("What is a number bettween 1 and 100");
userGuess = scan.nextInt();
if(userGuess > secretNumber)
{
System.out.println("That was to high. ");
}
else
{
if(userGuess < secretNumber)
{
System.out.println("That was to low. ");
}
else
{
break;
}
}
}
System.out.print("You are right!");
}
}