luc012.c (668B)
1 /* Write a program to check whether a triangle is valid or not, 2 if three angles of the triangle are entered through the keyboard. 3 A triangle is valid if the sum of all the three angles is equal to 180 degrees. */ 4 /* Let Us C, Chap- 3, Page - 53, Qn No.: f(c) */ 5 6 #include <stdio.h> 7 int main() 8 { 9 double angle1, angle2, angle3, sum; 10 printf("Enter the value of the three angle of the triangle : "); 11 scanf("%lf %lf %lf", &angle1, &angle2, &angle3); 12 sum = angle1 + angle2 + angle3; 13 if (sum == 180.0) 14 printf("\nThis Triangle is a valid one."); 15 else 16 printf("\nThis Triangle is not valid. Sum of the angles : %g", sum); 17 return 0; 18 }