![]() |
VOOZH | about |
Given an angle where, . The task is to check whether it is possible to make a regular polygon with all of its interior angle equal to . If possible then print "YES", otherwise print "NO" (without quotes).
Examples:
Input: angle = 90 Output: YES Polygons with sides 4 is possible with angle 90 degrees. Input: angle = 30 Output: NO
Approach: The Interior angle is defined as the angle between any two adjacent sides of a regular polygon.
It is given by where, n is the number of sides in the polygon.
This can be written as .
On rearranging terms we get, .
Thus, if n is an Integer the answer is "YES" otherwise, answer is "NO".
Below is the implementation of the above approach:
YES
Time Complexity: O(1), since there is no loop or recursion.
Auxiliary Space: O(1), since no extra space has been taken.