Page 136 - CA_Blue( J )_Class10
P. 136

12          System.out.print("Side 2 : ");
                13          s2=sc.nextInt();

                14          System.out.print("Side 3 : ");
                15          s3=sc.nextInt();

                16          if(s1==s2 && s2==s3)
                17          {

                18
                19               System.out.println("Equilateral  triangle  because  all the sides are
                                   equal");
                20          }

                21          else if(s1==s2 || s1==s3 || s2==s3)
                22          {

                23
                24              System.out.println("Isosceles triangle because two sides are equal");

                25          }
                26          else

                27          {
                28

                29              System.out.println("Scalene triangle because all sides are different");
                30          }

                31      }
                32  }

              You will get the following output:
















                             To input a number and print whether the number is a positive or negative even number or a
                Program 3
                             positive or negative odd number.
                 1  import java.util.*;
                 2  class check_no

                 3  {
                 4      public static void main()




                134134  Touchpad Computer Applications-X
   131   132   133   134   135   136   137   138   139   140   141