-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProgram03_Greatest.java
More file actions
32 lines (29 loc) · 1.02 KB
/
Program03_Greatest.java
File metadata and controls
32 lines (29 loc) · 1.02 KB
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
// Write a Java Program to find the Greatest Number of the 3 entered Numbers.
// Date : 20/12/2023, Author : Yash Wadhvani
import java.util.*;
public class Program03_Greatest {
public static void main(String[] args) {
try (Scanner sc = new Scanner(System.in)) {
int a, b, c;
System.out.println("Enter 1st No. :- ");
a = sc.nextInt();
System.out.println("Enter 2nd No. :- ");
b = sc.nextInt();
System.out.println("Enter 3rd No. :- ");
c = sc.nextInt();
if (a > b) {
if (a > c) {
System.out.println("\n" + a + " Is Greatest.");
} else {
System.out.println("\n" + c + " Is Greatest.");
}
} else {
if (b > c) {
System.out.println("\n" + b + " Is Greatest.");
} else {
System.out.println("\n" + c + " Is Greatest.");
}
}
}
}
}