Wednesday, March 29, 2017

Valid Triangles

Write a program to check whether a triangle is valid or not, when the three angles of the triangle 
are the inputs. A triangle is valid if the sum of all the three angles is equal to 180 degress.

Input
The first line contains an integer T, total number of testcases. Then follow T lines, each line contains three angles A, B and C of triangle separated by space.

Output
Display 'YES' or 'NO' if the triangle is Valid or not respectively.

Constraints
1 ≤ T ≤ 1000
40 ≤ A,B,C ≤ 180

#include <stdio.h>
int main()
{   int t,i,n,x,y,z;
    scanf("%d",&t);
    for(i=0;i<t;i++)
    {   scanf("%d",&x);
        scanf("%d",&y);
        scanf("%d",&z);
        if(((x+y+z)==180)&&(x>0)&&(y>0)&&(z>0))
            printf("YES\n");
        else
            printf("NO\n");
    }
    return 0;


}

1 comment:

  1. All I can say is great work. The effort you put into this is very impressive and I enjoyed every minute of the read.  I hope to come back and see more articles you've written.  
    The degress true meaning To go backwards or lose ones higher ranking such as one worker being lame and thus oned-up for life by a new coworker who is supremely awesome.

    ReplyDelete