-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathLargestOf3Numbers.java
More file actions
25 lines (25 loc) · 840 Bytes
/
LargestOf3Numbers.java
File metadata and controls
25 lines (25 loc) · 840 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
import java.util.*;
public class LargestOf3Numbers{
public static void main(String args[]){
Scanner sc = new Scanner(System.in);
System.out.print("Enter the 1st number: ");
int num1 = sc.nextInt();
System.out.print("Enter the 2nd number: ");
int num2 = sc.nextInt();
System.out.print("Enter the 3rd number: ");
int num3 = sc.nextInt();
if (num1>=num2){
if (num1>=num3){
System.out.println("Largest number is "+num1);
}else{
System.out.println("Largest number is "+num3);
}
}else{
if (num2>=num3){
System.out.println("Largest number is "+num2);
}else{
System.out.println("Largest number is "+num3);
}
}sc.close();
}
}