How to write a C Program to find the Angles of a Triangle if two angles are given with an example? The sum of all angles in a triangle = 180. It means if two angles of a triangle are given, then the third angle will be 180 – (angle 1 + angle 2).
This program allows the user to enter two angles of a triangle and then find the third angle. For this, we use the mathematical formula.
#include<stdio.h>
int main()
{
float a, b, c;
printf("\n Please Enter two angles of a triangle \n");
scanf("%f%f",&a,&b);
c= 180 - (a + b);
printf("\n Third Angle of a Triangle = %.2f\n", c);
return 0;
}
