HSC Main Book Question-08 Solve
#include<stdio.h>
#include<conio.h>
int main()
{
int a,b,c;
printf("Please enter the leanth of the three edges on a triangle");
scanf("%d%d%d",&a,&b,&c);
((a||b||c)!=0&&(a+b)>c&&(b+c)>a&&(a+c)>b)?printf("Triangle"):printf("Not Triangle");
return 0;
}
//Another Way To Solve:
/*
#include<stdio.h>
#include<conio.h>
int main()
{
int a,b,c;
scanf("%d%d%d",&a,&b,&c);
if((a+b)>c&&(b+c)>a&&(c+a)>b&(a||b||c)!=0)
{
printf("It is a triangle\n");
}
else
{
printf("It is not a triangle\n");
}
return 0;
}
*/
No comments