Qué onda, fellows.

This is the post for the WSQ09. It is about calculate the factorial of a number that the users provides. And also, you have to show the option to repeat the program or exit.

Here the image showing the program:

wsq09

To calculate the factorial I used a for loop, starting with a variable that starts with “1” and multiplying this variable by the number, and then by the number minus one, and then by the number minus two, until the original number is 1.

For repeat the code, I just put all the main code into a “do while” loop, that repeats only if the user asks with a ‘y’ to the question.

That’s all folks! Nice day.

The code is over here: https://github.com/hrglez/TC1017/blob/master/WSQ09%20-%20Factorial

CC BY 4.0 WSQ09, Factorial by hrglez is licensed under a Creative Commons Attribution 4.0 International License.