C – Check whether the Triangle is VALID based on the input lengths of its three SIDES entered through the keyboard. A triangle is considered valid if the sum of any two sides is greater than the largest of the three sides.

#include<stdio.h>
int main(){
float a,b,c,sum,max;
printf("enter the length of sides of triangle: ");
scanf("%f %f %f",&a,&b,&c);

sum= a+b+c;
if(a>b && a>c){
    max = a;
}
else if(b>a && b>c){
    max = b;
}
if( a+b>max || a+c>max || b+c>max ){
printf("the triangle is valid ");
}
else{
printf("the triangle is not valid ");
}
return 0;
}

Scroll to Top
logo
Privacy Overview

This website uses cookies so that we can provide you with the best user experience possible. Cookie information is stored in your browser and performs functions such as recognising you when you return to our website and helping our team to understand which sections of the website you find most interesting and useful.