Loops and procedure problem

I see you are doing trigonometry.

See

for how to bridge between Excel trigonometry and AI2 trigonometry.