Dcoder icon

Valid Quadrilateral @ Dcoder

By Lochard | As a newbie programmer | 12 Apr 2023


Problem: John loves gardening. He believes that for good growth of the plant, the land should be quadrilateral. Given angles of 4 sides of the land. Find whether the land is a valid quadrilateral or not. A quadrilateral is valid if the sum of all four angles is equal to 360 degrees.

Input: The first line contains an integer T, total number of test cases. The next T lines, each, contain four angles A, B, C and D of a quadrilateral separated by space.

Output: Print "YES" if the quadrilateral is valid, else print "NO", without the double quotes.

Constraints: 1 ≤ T ≤ 100

1 ≤ A,B,C and D ≤ 360

Sample Input: 2

90 90 90 90

180 180 45 55

Sample Output: 

YES

NO

for i in range(int(input())):
  print('YES' if sum(map(int, input().split())) == 360 else 'NO')

How do you rate this article?

0


Lochard
Lochard

20240228 Arrived in the UK for about 2 week. All my fears persist. Some are even getting worse. https://github.com/locharp/asylum_diary/


As a newbie programmer
As a newbie programmer

Sharing entry level codes. My snippets on GitHub https://github.com/locharp/code-snippets

Publish0x

Send a $0.01 microtip in crypto to the author, and earn yourself as you read!

20% to author / 80% to me.
We pay the tips from our rewards pool.