2. WAP to accept the length of three sides of a triangle and check if formation of
triangle is possible or not. If triangle can be formed check if it is an equilateral,
isosceles or scalene triangle.
Answers
Answered by
3
Answer:
//Assuming it is Java programming
import java.util.Scanner;
class triangle {
public static void main (String ar []){
Scanner sc=new Scanner(System.in);
System.out.println("Enter 3 sides");
int a=sc.nextInt();
int b=sc.nextInt();
int c=sc.nextInt();
if((a+b+c)==180){
System.out.println("Triangle possible");
if ((a==b)&&(b==c))
System.out.println("Equilateral triangle");
else if ((a==b)||(b==c)||(c==a))
System.out.println("Isoceles Triangle");
else
System.out.println("Scalene Triangle");
}
else
System.out.println("Triangle Not Possible");
}
}
Similar questions
English,
13 days ago
Physics,
26 days ago
Math,
26 days ago
Math,
8 months ago
Accountancy,
8 months ago