# A formula for the exterior angles of an irregular polygon, given interior angles?

So I took a challenge from my Geometry teacher to create code that when the user gives the computer how many angles / sides a polygon has and the angle of each of the interior angles it could find each of the exterior angles whether it is regular or irregular. For example the user tells the computer they have a four-sided shape (quadrilateral), the interior angles are $70, 75, 110, 145$. The computer would then be able to output each corresponding angle in the proper order. My problem is that with coding you can't just type in the human logic so I need a formula to work from: what on earth would be a formula that could apply to any polygon with any number of sides (irregular or regular)?

At each vertex of the polygon, the interior angle and exterior angle must sum to $180$. You can use this to find the value of each exterior angle.
The other answer is not complete, because you can have a non convex polygon (i.e one interior angle can be 240) and to say that $$180-$$input_angle is not all correct.
1. read angles and save them as a list angles_list
2. initialize and empty array with size equal to angles_list with name exteriors.
3. loop over elements in angles_list, if element is greater than 180, then append to exteriors $$360-$$element, else append $$180-$$element
4. return exteriors