Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 i need help with square roots
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
mattsyv




PostPosted: 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:

Sponsor
Sponsor
Sponsor
sponsor
do_pete




PostPosted: Thu Jan 26, 2006 1:28 pm   Post subject: (No 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
blaster009




PostPosted: Thu Jan 26, 2006 8:12 pm   Post subject: (No 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...
Display posts from previous:   
   Index -> Programming, Turing -> Turing Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 3 Posts ]
Jump to:   


Style:  
Search: