luc012.c
Problem Statement
luc012.c
Write a program to check whether a triangle is valid or not, if three angles of the triangle are entered through the keyboard. A triangle is valid if the sum of all the three angles is equal to 180 degrees.
Source Code
c
#include <stdio.h>
int main()
{
double angle1, angle2, angle3, sum;
printf("Enter the value of the three angle of the triangle : ");
scanf("%lf %lf %lf", &angle1, &angle2, &angle3);
sum = angle1 + angle2 + angle3;
if (sum == 180.0)
printf("\nThis Triangle is a valid one.");
else
printf("\nThis Triangle is not valid. Sum of the angles : %g", sum);
return 0;
}1
2
3
4
5
6
7
8
9
10
11
12
13
2
3
4
5
6
7
8
9
10
11
12
13
● Author - Amit Dutta · Updated - 12 Dec 2025