C program to check triangle is valid or not
This code checks if whether the triangle is valid or not with given side measurements.
/* Aim: To check whether given dimensions of triangle are correct or not */
#include<stdio.h>
void main()
{
int a,b,c,d,e,f;
printf("\n Enter dimensions of triangle:-");
scanf("%d%d%d",&a,&b,&c);
d=a+b;
e=a+c;
f=b+c;
if ((d>c) && (f>a))
{
if (e>b)
printf("\n The triangle is valid with %d %d %d as dimensions \n \n",a,b,c);
else
printf("\n The triangle is invalid with %d %d %d as dimensions\n \n",a,b,c);
}
}
Output:
Enter dimensions of triangle:-4 8 9
The triangle is valid with 4 8 9 as dimensions