Skip to content

Commit 941d0f0

Browse files
Create greatest number of three.java
1 parent a06bab0 commit 941d0f0

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed

greatest number of three.java

+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
import java.util.Scanner;
2+
class input{
3+
public static void main(String[]args){
4+
5+
Scanner input = new Scanner(System.in);
6+
7+
int a,b,c;
8+
9+
System.out.println("Enter first number: ");
10+
a = input.nextInt();
11+
System.out.println("Enter second number: ");
12+
b = input.nextInt();
13+
System.out.println("Enter third number: ");
14+
c = input.nextInt();
15+
16+
17+
18+
if (a >= b && a >= c){
19+
System.out.println("The largest number is "+ a);
20+
}
21+
else if(b >= a && b >= c){
22+
System.out.println("The largest number is "+ b);
23+
}
24+
else if(c >= b && c >= a){
25+
System.out.println("The largest number is "+ c);
26+
}
27+
else{
28+
System.out.printf("Invalid input");
29+
}
30+
}
31+
}

0 commit comments

Comments
 (0)