I looked at some solutions here but none provide what I need, so:
I need to average an array of angles(0 to 359.9, no negatives) (A1 + A2 + A3 + An) / n
The
A ray leaving a circle can be represented in more than one manner. It could be 0 degrees, 360 degrees, 720 degrees, etc. You need to determine what is the correct acceptable answer for you case, and covert intermediate answers to the final answer before presenting it.
1 + 359 + 2 + 358 = 360 + 360 = 720 degrees in total
720 / 4 = 360 / 2 = 180 degrees on average
It's not that the answer should be zero, it's that 359 degrees is not equivalent to -1 degrees because the angle goes around the circle "the other way".