-
Notifications
You must be signed in to change notification settings - Fork 23
Expand file tree
/
Copy pathMain.java
More file actions
36 lines (26 loc) · 862 Bytes
/
Main.java
File metadata and controls
36 lines (26 loc) · 862 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;
/**
* Created by iyasuwatts on 10/17/17.
*/
public class Main {
public static void main(String[] args){
Scanner Number = new Scanner(System.in);
int num1 = (int) (Math.random() * 100);
int guess = 5;
int i, tryMe;
System.out.println("Guess a number! Any number!");
for( i = 0; i < guess; i++) {
tryMe = Number.nextInt();
if (num1 == tryMe) {
System.out.println("You got it dude!");
} else if (num1 > tryMe) {
System.out.println("Too small!");
} else if (num1 < tryMe) {
System.out.println("Too big!");
}
}if (i == guess)
{System.out.println("Better luck next time!");
System.out.println("The number was " + num1);
}
}
}