Hello coders, today we are going to solve Valid Triangles CodeChef Solution whose Problem Code is FLOW013.
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 degrees.
The first line contains an integer T, the total number of testcases. Then T lines follow, each line contains three angles A, B and C, of the triangle separated by space.
For each test case, display ‘YES’ if the triangle is valid, and ‘NO’, if it is not, in a new line.
- 1 <= T <= 1000
- 1 <= A, B, C <= 180
3 40 40 100 45 45 90 180 1 1
YES YES NO
Solution – Valid Triangles – CodeChef Solution
#Solution Provided by CodingBroz T = int(input()) while T > 0: a, b, c = map(int, input().split()) sum = a + b + c if (sum == 180): print("YES") else: print("NO") T = T - 1
Disclaimer: The above Problem (Valid Triangles) is generated by CodeChef but the Solution is provided by CodingBroz. This tutorial is only for Educational and Learning Purpose.