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



Task

Given   n,   find the   nth   roots of unity.




PI = 3.1415926535
FOR n = 2 TO 5
  PRINT n;":" ;
   FOR root = 0 TO n-1
     real = COS(2*PI * root / n)
     imag = SIN(2*PI * root / n)
     PRINT using("-##.#####",real);using("-##.#####",imag);"i";
     IF root <> n-1 then PRINT "," ;
  NEXT
  PRINT
NEXT 
 