luc012.c ​
Metadata ​
- Author — Amit Dutta (amitdutta4255@gmail.com)
- Last updated — 12 Dec 2025
- License — MIT
Problem Statement ​
Problem Statement
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 ​
Printing the code
To print this file, open it on GitHub and click Raw before printing, or use the Download Raw button above and print directly from that page.
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