# C Program to Check Triangle is Valid or Not using Angles

In this tutorial, i am going to show you how to check whether triangle is valid or not if angles are given in c programs.

## All C Programs and Algorithm to Check Triangle is Valid or Not using Angles

• Algorithm to Check Triangle is Valid or Not using Angles
• C Program to Check Triangle is Valid or Not using Angles

### Algorithm to Check Triangle is Valid or Not using Angles

Follow the below given algorithm to write a program to find the third angle of a triangle if two angles are given; as follows:

1. Take input angles of triangle from user and store it in some variables.
2. Compute sum of all three angles, store sum in some variables.
3. Check `if(sum == 180)` then, triangle can be formed otherwise not.

### C Program to Check Triangle is Valid or Not using Angles

```/* C Program to Check Triangle is Valid or Not using Angles */

#include<stdio.h>

int main()
{
int angle1, angle2, angle3, Sum;

printf("\n Please Enter Three Angles of a Triangle : ");
scanf("%d%d%d", &angle1, &angle2, &angle3);

Sum = angle1 + angle2 + angle3;

if(Sum == 180)
{
printf("\n This is a Valid Triangle");
}
else
{
printf("\n This is an Invalid Triangle");
}
return 0;
}```

The output of the above c program; as follows:

```Please Enter Three Angles of a Triangle : 90 45 45
This is a Valid Triangle```