Triangle Validity
Practice this coding question on Coding Gurukul.
Problem statement
A design class proposes three interior angles for a triangular window. Before drawing the frame, the drafting tool checks whether those angles can describe a nondegenerate triangle. Your task Given three integer angles a, b, and c in degrees, determine whether they form a valid triangle. Important details All three angles must be strictly positive and their sum must be exactly 180. These inputs are angles, not side lengths, so do not apply the triangle inequality for sides. An angle of zero is invalid even if the total is 180. Equal angles are allowed. Worked example Angles 50, 60, and 70 are positive and total 180, so print 1. Angles 0, 90, and 90 also total 180 but fail the positivity rule, so print 0.
Input format
One line contains a b c.
Output format
Print 1 if valid, otherwise 0.
Constraints
0 <= a, b, c <= 180.
Sample input
50 60 70
Sample output
1
Sign in to run or submit a solution in C++, Java or Python.