Computer Science, asked by falgunisarkar1980, 9 months ago

Write a program in java to accept three sides of triangle and check whether the triangle is possible or not. If possible classify it as scalene,isosceles or equilateral triangle​.​

Answers

Answered by harshitha200611
68

Explanation:

public class Triangle

{

public static void main( )

{

int a, b, c;

System.out.println(" Enter the first side of the triangle");

a = sc.nextInt( );

System.out.println("Enter the second side of the triangle")

b= sc.nextInt( );

System.out.println("Enter the third side of the triangle");

c=sc.nextInt( );

if ( (a+b)>c )

System.out.println ("Triangle is possible");

if ( (b+c)>a )

System.out.println("Triangle is possible");

if ( (c+a)>b )

System.out.println("Triangle is possible");

else

System.out.println("Triangle is not possible");

if ( (a!=b) && (b!=c) && (c!=a) )

System.out.println (" Scalene triangle ");

if ( (a=b) || (b=c) || (c=a) )

System.out.println ("Isosceles triangle");

if ( (a=b) && (b=c) && (c=a) )

System.out.println ("Equilateral triangle");

}

}

Hope this answer helps........

Similar questions