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



Task

Given   n,   find the   nth   roots of unity.




with javascript_semantics
for n=2 to 10 do
    printf(1,"%2d:",n)
    for root=0 to n-1 do
        atom real = cos(2*PI*root/n)
        atom imag = sin(2*PI*root/n)
        printf(1,"%s %6.3f %6.3fi",{iff(root?",":""),real,imag})
    end for
    printf(1,"\n")
end for
