Validity of a triangle

Algorithm

Input	Three angle of triangle	   
Output	Valid or invalid	   
complexity O(1)	 

Triangle_valid(angle1, angle2, angle3)
1 if (angle1 = 0 or angle2 = 0 or angle3 = 0) then
2   print triangle is invalid
3 else
4   sum=angle1 + angle2 +angle3;
5   if (sum = 180) then
6     print triangle is valid;
7   else 
8     print triangle is invalid;

Algorithm Description

We know that sum of the angles of triangle is always 180. If sum is not Equal to 180 then triangle is invalid otherwise triangle is valid.

C Code

//Find that triangle is valid or not if angles are entered
//Input : Any three positive Integers as angles of the triangle

#include< stdio.h>
#include< conio.h>
int main()
{
    int a,b,c;
    printf("Enter the three angles of a triangle ");
    scanf("%d%d%d",&a,&b,&c);
    if(a+b+c==180&&(a!=0||b!=0||c!=0))
	    printf("Triangle is valid");
    else 
	    printf("Sum of three angles is not equal to 180 so triangle not  
            possible");  
}