Page 166 - computer science (868) class 11
P. 166

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
              --------------------------
















                164164  Touchpad Computer Science-XI
   161   162   163   164   165   166   167   168   169   170   171