...

# How do i write the pseudo and javascript code for this?

university
07-30-2011, 05:55 AM
how do i write a recursive program to calculate the factorial of a number between 0 and 6.if the user enters a number greater than 6 you should prompt the user again to input another number or -1 to exit the program.how do i write the pseudo code and the javascript code for this program?
i have no idea of how to do this and have been trying to figure it out since the last hour :(

bullant
07-30-2011, 06:57 AM
post the code you have so far and we can try to help you get it working. It's fairly straight forward.

Krupski
07-30-2011, 07:22 PM
how do i write a recursive program to calculate the factorial of a number between 0 and 6.if the user enters a number greater than 6 you should prompt the user again to input another number or -1 to exit the program.how do i write the pseudo code and the javascript code for this program?
i have no idea of how to do this and have been trying to figure it out since the last hour :(

Do the pseudo code first. That will make it a lot easier to write the real code in any language you want.

Pseudo code would be made of words and concepts like this:

(2) INPUT NUMBER RESULT ---> X
(3) IS X less than 0?
(4) YES, PRINT ERROR MESSAGE AND GOTO 1
(5) IS X greater than 6?
(6) YES, PRINT ERROR MESSAGE AND GOTO 1
(7) (comment) if here input is in range.
(8) ANSWER = 1 (comment) declare a variable