Computer Science Canada

i need help with square roots

Author:  mattsyv [ Thu Jan 26, 2006 1:08 pm ]
Post subject:  i need help with square roots

ok i have this loop i dont no how to square it can u plz help me
[/code]
var product : int
product := 1

for countLoop : 1 .. 5
product := product * sqrt
put countLoop, "...", product
put ""
end for
code:


Author:  do_pete [ Thu Jan 26, 2006 1:28 pm ]
Post subject: 

If you want to square a number you would go like this
code:
number := number ** 2

If you want the square root you would go:
code:
number := sqrt (number)

or
code:
number := number ** 0.5

Author:  blaster009 [ Thu Jan 26, 2006 8:12 pm ]
Post subject: 

And if you need to go further (cubic roots, quartic roots etc), just multiply by the equivalent fraction.

code:

final := number ** (1/2) % Square root
final := number ** (1/3) % Cubic root
final := number ** (1/4) % Quartic root


Etc...


: