-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgreatest.java
More file actions
30 lines (21 loc) · 801 Bytes
/
greatest.java
File metadata and controls
30 lines (21 loc) · 801 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
import java.util.Scanner;
public class greatest {
public static void main (String[] args) {
Scanner scanner = new Scanner(System.in);
System.out.println("Give the first number:");
int num1 = Integer.valueOf(scanner.nextLine());
System.out.println("Give the second number:");
int num2 = Integer.valueOf(scanner.nextLine());
if (num1 > num2) {
System.out.println("Greater number is: "+ num1);
}
else if (num1 < num2) {
System.out.println("Greater number is: " + num2);
}
else if (num1 == num2) {
System.out.println("The numbers are equal!");
} else {
System.out.println("something else");
}
}
}