Valid Triangles ( CodeChef Problem code: FLOW013 )

PROBLEM :

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
Example

Input

3
30 40 110
45 45 90
180 0 0
Output

YES
YES
NO
     
--------------------------------------------------------------------------------
SIMPLE c++ IMPLEMENTATION :
--------------------------------------------------------------------------------

#include<iostream>
using namespace std ;
int main()
{
int t,a,b,c ;
cin>>t ;
while(t--)
{
cin>>a>>b>>c ;
if(a+b+c==180)
cout<<"YES" ;
else
cout<<"NO" ;
cout<<endl ;
}
return 0 ;
}

---------------------------------------------------------------------------------

Comments

Popular posts from this blog

Count ways to N'th Stair(Order does not matter)

Replace all ‘0’ with ‘5’ in an input Integer

Chocolate Distribution Problem

Remove characters from the first string which are present in the second string

Primality Test ( CodeChef Problem code: PRB01 )