← Back to Loops
Question 385
Factorial By Loop
Factorial By Loop
Read a whole number n and compute n factorial (the product 1 * 2 * ... * n) with a while loop and a product variable that starts at 1, then print Factorial: <product>. Input: one integer of at least 0, no prompt; 0 gives 1 because the loop body never runs.
Expected Output:
Factorial: 120= newline. The output ends with a newline — print one after the last line.
Hints3 available
Sign in to use hintsTopics:
Loops
1
Tab to indent (Esc then Tab to move on) · Ctrl+Enter to run · Ctrl+Space to expand shortcuts (pr, inp, def)
Your Output
Run your code to see the output here...
Test Cases
Run your code to see test case results.