Page 190 - Cs_withBlue_J_C11_Flipbook
P. 190
14 {
15 if(b>c)
16 System.out.println(b + " is the 2nd greatest number");
17 else
18 System.out.println(c + " is the 2nd greatest number");
19 }
20
21 if((b>a) && (b>c))
22 {
23 if(a > c)
24 System.out.println(a + " is the 2nd greatest number");
25 else
26 System.out.println(c + " is the 2nd greatest number");
27 }
28 if((c>a) && (c>b))
29 {
30 if(a > b)
31 System.out.println(a + " is the 2nd greatest number");
32 else
33 System.out.println(b + " is the 2nd greatest number");
34 }
35 System.out.println("--------------------------");
36 }
37 }
The output of the preceding program is as follows:
Enter three numbers : 6
3
5
--------------------------
5.0 is the 2nd greatest number
--------------------------
188188 Touchpad Computer Science-XI

