enter three sides of a triangle and check the triangle is possible or not if possible what type of triangle is it write a program
Answers
Answer:
#include <stdio.h>
int main()
{
int side1, side2, side3;
/* Input sides of a triangle */
printf("Enter three sides of triangle: ");
scanf("%d%d%d", &side1, &side2, &side3);
if((side1 + side2 > side3) && (side2 + side3 > side1) && (side1 + side3 > side2)){
if(side1==side2 && side2==side3)
{
/* If all sides are equal */
printf("Equilateral triangle.");
}
else if(side1==side2 || side1==side3 || side2==side3)
{
/* If any two sides are equal */
printf("Isosceles triangle.");
}
else
{
/* If none sides are equal */
printf("Scalene triangle.");
}
}
else{
printf("not possible to form triangle");
}
return 0;
}
Explanation: