-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGreatest.java
More file actions
32 lines (29 loc) · 913 Bytes
/
Copy pathGreatest.java
File metadata and controls
32 lines (29 loc) · 913 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
import java.util.*;
public class Greatest {
public static void main(String[] args){
int a,b,c;
Scanner sc = new Scanner(System.in);
System.out.println("Enter three numbers:");
a = sc.nextInt();
b = sc.nextInt();
c = sc.nextInt();
if(a>b && a>c){
System.out.println("Gretest number is : "+ a);
}
else if(b>c && b>a){
System.out.println("Greatest number is: "+b);
}
else if(a==b && a>c ){
System.out.println(+ a + " "+b+" Both are greatest numbers");
}
else if(a==c && a>b){
System.out.println(+ a + " "+c+" Both are greatest numbers");
}
else if(b==c && b>a){
System.out.println(+ b + " "+c+" Both are greatest numbers");
}
else{
System.out.println("Greates number is : " + c);
}
}
}