-
Notifications
You must be signed in to change notification settings - Fork 27
Expand file tree
/
Copy pathGreaterThree.java
More file actions
27 lines (26 loc) · 805 Bytes
/
Copy pathGreaterThree.java
File metadata and controls
27 lines (26 loc) · 805 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
import java.sql.SQLOutput;
import java.util.Scanner;
//Greatest of the Three numbers
public class GreaterThree {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
System.out.print("Enter first number: ");
int a = sc.nextInt();
System.out.print("Enter second number: ");
int b = sc.nextInt();
System.out.print("Enter third number: ");
int c = sc.nextInt();
if (a>b & a>c){
System.out.print("First number is greatest");
}
else if (a < c){
System.out.print("Third number is greater");
}
else if (a < b){
System.out.println("Second number is greater");
}
else{
System.out.println("All are equal");
}
}
}