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



Task

Given   n,   find the   nth   roots of unity.




func roots_of_unity(n) {
    n.of { |j|
        exp(2i * Num.pi / n * j)
    }
}
 
roots_of_unity(5).each { |c|
    printf("%+.5f%+.5fi\n", c.reals)
}