Friday, December 23, 2011

Program to check whether the triangle in Equilateral, isosceles or scalene


import java.util.*;
public class Ch2Q7
{
    public static void main(String[] args)
    {Scanner kbd = new Scanner(System.in);
     double a, b, c;
     System.out.print("Enter 3 sides: ");
     a = kbd.nextDouble();
     b = kbd.nextDouble();
     c = kbd.nextDouble();
     if(a+b>c&&b+c>a&&a+c>b)
      if(a== b && b== c)
       System.out.println("Equilateral");
      else if(a==b||b==c||a==c)
         System.out.println("Isoscales");
      else System.out.println("Scalene");
     else System.out.println("Not Possible");
    }
}

No comments:

Post a Comment