18 lines
382 B
Plaintext
18 lines
382 B
Plaintext
rem - return nth root of x
|
|
function nthroot(x, n = real) = real
|
|
end = exp((1.0 / n) * log(x))
|
|
|
|
rem - exercise the routine by finding successive roots of 144
|
|
var i = integer
|
|
var x = real
|
|
|
|
x = 144
|
|
print "Finding the nth root of"; x
|
|
print " x n root"
|
|
print "-----------------------"
|
|
for i = 1 to 8
|
|
print using "### #### ###.####"; x; i; nthroot(x, i)
|
|
next i
|
|
|
|
end
|