Task

Implement the algorithm to compute the principal   nth   root   





A

n





{\displaystyle {\sqrt[{n}]{A}}}

   of a positive real number   A,   as explained at the   Wikipedia page.



 
PROCEDURE nth
   PARAM N : INTEGER; A, P : REAL
   DIM   TEMP0, TEMP1 : REAL
TEMP0 := A
TEMP1 := A/N
WHILE ( abs(TEMP0 - TEMP1) > P) DO
  TEMP0 := TEMP1
  TEMP1 := (( N - 1.0) * TEMP1 + A / TEMP1 ^ (N - 1.0)) / N
ENDWHILE
PRINT "Root            Number          Precision"
PRINT N, A, P
PRINT "The Root is: ";TEMP1
END
 