Q. Write a C program to find whether a triangle can be formed or not.

Q. Write a C program to check the triangle is equilateral, isosceles, equilateral, scalene or right-angled triangle.

Q. Write a program to check whether a triangle is valid or not, when the three sides of the triangle are entered through the keyboard.

**SOLUTION : **

#include<stdio.h>
int main()
{
float a,b,c;
printf("\n Enter value for Side-1 : ");
scanf("%f",&a);
printf("\n Enter value for Side-2 : ");
scanf("%f",&b);
printf("\n Enter value for Side-3 : ");
scanf("%f",&c);
if(a<(b+c)&&b<(a+c)&&c<(a+b))
{
printf("\n RESULT: It is a Triangle.");
if(a==b&&a==c&&b==c)
printf("\n It is a Equilateral Triangle.");
else if(a==b||a==c||b==c)
printf("\n It is a Isosceles Triangle.");
else if((a*a)==(b*b)+(c*c)||(b*b)==(a*a)+(c*c)||(c*c)==(a*a)+(b*b))
printf("\n It is a Right-angle Triangle.");
else if(a!=b&&a!=c&&b!=c)
printf("\n It is a Scalene Triangle.");
}
else
printf("\n RESULT: This Triangle is NOT possible.");
getch ();
return 0;
}

**OUTPUT OF SOLUTION :**

### Like this:

Like Loading...

*Related*

help

basic concept

How you are using getch (); without header file

conio.h

Hey!!! Can u give me a program that detects impossible entries for sides of triangle like 0 or negative values??