How to resolve the algorithm Roots of unity step by step in the Icon and Unicon programming language

Published on 12 May 2024 09:40 PM

How to resolve the algorithm Roots of unity step by step in the Icon and Unicon programming language

Table of Contents

Problem Statement

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

Given   n,   find the   nth   roots of unity.

Let's start with the solution:

Step by Step solution about How to resolve the algorithm Roots of unity step by step in the Icon and Unicon programming language

Source code in the icon programming language

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


  

You may also check:How to resolve the algorithm Terminal control/Ringing the terminal bell step by step in the NetRexx programming language
You may also check:How to resolve the algorithm Factors of an integer step by step in the Kotlin programming language
You may also check:How to resolve the algorithm Power set step by step in the jq programming language
You may also check:How to resolve the algorithm Unicode variable names step by step in the Objeck programming language
You may also check:How to resolve the algorithm Minimum positive multiple in base 10 using only 0 and 1 step by step in the Tcl programming language