Monday, November 13, 2017

Valid Triangles Codechef Problem Solution

https://www.codechef.com/problems/FLOW013

#include<iostream>

using namespace std;

bool triangle(int a,int b,int c)

{
    if((a+b+c)<180 || (a+b+c)>180 || (a==0||b==0||c==0) || (a>90||b>90||c>90))
    {
        return false;
    }
    else
        return true;
}
int main()

{
   int t,a,b,c;
    cin>>t;
     while(t--)
     {
         cin>>a>>b>>c;
         if(triangle(a,b,c))
         {
             cout<<"YES"<<endl;
         }
         else
         {
             cout<<"No"<<endl;
         }
     }
     return 0;
}

No comments:

Post a Comment