Here is a C program find third angle of triangle, given other two angles of triangle. 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.
Required Knowledge
Sum of all internal angles of a triangle is 180 degrees.
- A + B + C = 180
C program to find third angle of a triangle
#include <stdio.h> #define ANGLE_SUM 180 int main() { float a1, a2, a3; printf("Enter Two Angles of a Triangle\n"); scanf("%f %f", &a1, &a2); 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
Related Topics