Hello and welcome to our community! Is this your first visit?
Enjoy an ad free experience by logging in. Not a member yet? Register.

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

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

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

• post the code you have so far and we can try to help you get it working. It's fairly straight forward.

• Originally Posted by university
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:

(1) ASK USER FOR NUMBER
(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
(10) X = X - 1
(11) IF X greater than 0 GOTO 9
(12) PRINT result is ANSWER

Make sense?

•