**C program to check triangle validity when angles are given using conditional operator.**

**C program to check triangle validity when angles are given using conditional operator**

#include <stdio.h>
int main()
{
int angle1, angle2, angle3, sum;
printf(" Enter first angles of triangle: ");
scanf("%d", &angle1);
printf(" Enter second angles of triangle: ");
scanf("%d", &angle2);
printf(" Enter third angles of triangle: ");
scanf("%d", &angle3);
/* Sum of tree angles */
sum = angle1 + angle2 + angle3;
(sum == 180 && angle1 > 0 && angle2 > 0 && angle3 > 0)?
printf("Triangle is valid."):
printf("Triangle is not valid.");
return 0;
}

**Output:**

Enter first angles of triangle: 80
Enter second angles of triangle: 50
Enter third angles of triangle: 60
Triangle is not valid.
Enter first angles of triangle: 80
Enter second angles of triangle: 50
Enter third angles of triangle: 50
Triangle is valid.