We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 2e4a4b6 commit 13477a2Copy full SHA for 13477a2
1 file changed
module1/Greatest3.java
@@ -0,0 +1,20 @@
1
+//Program to find the greatest among three numbers by using the ternary operation
2
+import java.util.Scanner;
3
+class ThreeG
4
+{
5
+ public static void main(String args[])
6
+ {
7
+ Scanner reader = new Scanner(System.in);
8
+ System.out.print("\nEnter the first number = ");
9
+ int fn = reader.nextInt();
10
+ System.out.print("\nEnter the second number = ");
11
+ int sn = reader.nextInt();
12
+ System.out.print("\nEnter the third number = ");
13
+ int tn = reader.nextInt();
14
+ reader.close();
15
+ int result = (fn > sn ? (fn > tn ? fn: tn) : (sn > tn? sn : tn ));
16
+ System.out.print("\nGreatest number among three is " + result);
17
+
18
19
+ }
20
+}
0 commit comments