-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFindGreatest.java
More file actions
36 lines (30 loc) · 795 Bytes
/
FindGreatest.java
File metadata and controls
36 lines (30 loc) · 795 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
36
//15:Write a program to find greatest of three numbers
//using nested if-else.
import java.util.Scanner;
public class FindGreatest {
public static void main(String[] args) {
int num1,num2,num3;
Scanner input = new Scanner(System.in);
System.out.print("Enter first number :");
num1=input.nextInt();
System.out.print("Enter second number :");
num2=input.nextInt();
System.out.print("Enter third number :");
num3=input.nextInt();
if(num1>=num2)
{
if(num1>=num3)
System.out.println(num1+" is greatest among all.");
else
System.out.println(num3+" is greatest among all.");
}
else
{
if(num2>=num3)
System.out.println(num2+" is greatest among all.");
else
System.out.println(num3+" is greatest among all.");
}
input.close();
}
}