- Write a C program find third angle of triangle.
Required Knowledge
- C printf and scanf functions
- C Arithmetic Operators
We will first take two angles of a triangle as input from user using scanf function. To find the third angle of triangle we will use below mentioned angle sum property of a triangle.
Sum of all internal angles of a triangle is 180 degrees.
- A + B + C = 180
Where A, B and C are the three internal angles of a triangle.
C program to find third angle of a triangle

/*
* Given two angles of a triangle, Here is the
* C program to find third angle
*/
#include <stdio.h>
#define ANGLE_SUM 180
int main() {
/* Three angles of a triangle */
float a1, a2, a3;
/*
* Take two angles as input from user
*/
printf("Enter Two Angles of a Triangle\n");
scanf("%f %f", &a1, &a2);
/* Sum of all three angles of a triangle is 180 degrees */
a3 = ANGLE_SUM - (a1 + a2);
printf("Third Angle = %0.4f", a3);
return 0;
}
Output
Enter Two Angles of a Triangle 30 60 Third Angle = 90.0000