Email me the answer
I don't need an answer
Close
Bookmark this site:
Returning Users: Log in
Email:
Password:
Forgot password?
New users: Sign up
Full Name:
Email:
Password:
Close

Forgot your password?
Enter your e-mail address below to have a password reset code sent to your inbox.

E-mail address:
Close
Complete your profile

Full Name
Email
Password
How to square and cube a number in pseudocode?
Okay I have looked around here and I am in a fix... I have to create 2 methods, one for squaring a number and the other to cube a number. I have not gotten very far in math so I am dumbfounded right now... Can someone help me on explaining how to square and cube a number through pseudo code? I am using "Programming Logic and Design" Fifth Edition as a book for school.
2 Answers
Pseudocode is plain natural speaking language (English) + programming code. In other words, pseuducode is the algorithm made to be understood by humans, not computers.

So, you don't need to think about how to code it for pseudocode. Generally speaking in many programming lanaguages and in mathematical terms, they are usually just plainly coded as x^2 and x^3 where x is the variable used.

Good luck! :-)
This sounds like an exercise regarding functions rather than actually squaring and cubing.. you'd want something like:

square(int x):
return x*x

cube(int x)
return x*x*x

.. Pseudocode, as you can see, is pretty easy to read. You could also use x^2 and x^3, but in many programming languages it's easier to just multiply, so I used that notation.
 Add Your Answer!