C Program to Find Third Angle of a Triangle

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
Where A, B and C are the three internal angles of a triangle.

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
C program to check whether three angles of triangle is valid or not
C program to check whether three sides of triangle is valid or not
C program to check whether a triangle is equilateral, isosceles or scalene.
C program to calculate area of a right angled triangle
C program to calculate area of an equilateral triangle
C Program to print Floyd's triangle
C program to print pascal triangle till N rows
C program to print triangle and pyramid patterns of star(*)
C program to calculate area of any triangle
List of all C programs