-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathLargestNumber.java
More file actions
35 lines (25 loc) · 820 Bytes
/
LargestNumber.java
File metadata and controls
35 lines (25 loc) · 820 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
33
34
35
import java.util.Scanner;
public class LargestNumber {
public static void main(String[] args){
Scanner n= new Scanner(System.in);
int n1,n2,n3;
System.out.print("Enter the 1st number : ");
n1=n.nextInt();
System.out.print("Enter the 2nd number : ");
n2=n.nextInt();
System.out.print("Enter the 3rd number : ");
n3=n.nextInt();
if(n1>n2 && n1>n3){
System.out.println("The largest number is : "+n1);
}
else if(n2>n1 && n2>n3){
System.out.println("The largest number is : "+n2);
}
else if(n3>n1 && n3>n2){
System.out.println("The largest number is : "+n3);
}
else{
System.out.println("Please try with right inputs.");
}
}
}