The purpose of this task is to explore working with   complex numbers.



Task

Given   n,   find the   nth   roots of unity.




#define twopi 6.2831853071795864769252867665590057684
 
dim as uinteger m, n
dim as double real, imag, theta
input "n? ", n
 
for m = 0 to n-1
    theta = m*twopi/n
    real = cos(theta)
    imag = sin(theta)
    if imag >= 0 then
        print using "#.##### + #.##### i"; real; imag
    else
        print using "#.##### - #.##### i"; real; -imag
    end if
next m