C Program to find Third Angle of Triangle if Two Angles Are Given

C Program to find Third Angle of Triangle if Two Angles Are Given

Write C Program to find the Third Angle of the Triangle if Two Angles Are Given

//Write a C Program to find Third Angle of Triangle if Two Angles Are Given

#include <stdio.h>

int main()
{
    int a1, a2, a3;


    printf("Enter Angle 1 :--> ");
    scanf("%d", &a1);

    printf("Enter Angle 2 :--> ");
    scanf("%d", &a2);

    a3 = 180 - (a1 + a2);   //sum of all the angles is 180

    printf("Third angle of the triangle :--> %d", a3);

    return 0;
}

Output:

Enter Angle 1 :--> 30
Enter Angle 2 :--> 80

Third angle of the triangle :--> 70