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



Task

Given   n,   find the   nth   roots of unity.




procedure main()
   roots(10)
end
 
procedure roots(n)
   every n := 2 to 10 do
       every writes(n | (str_rep((0 to (n-1)) * 2 * &pi / n)) | "\n")
end
 
procedure str_rep(k)
  return " " || cos(k) || "+" || sin(k) || "i"
end