Question: Problem 5: Multiple factorials Write code to print the first 10 factorials, in reverse order. In other words, write code that prints 10!, then prints

Problem 5: Multiple factorials

Write code to print the first 10 factorials, in reverse order. In other words, write code that prints 10!, then prints 9!, then prints 8!, ..., then prints 1!. Its literal output will be:

3628800 362880 40320 5040 720 120 24 6 2 1 

The first line of your solution should assign a variablenumlinesto10, and then the rest of your solution must not use10anywhere.

Hint: Use two nestedforloops.

The outer loop sets the value ofnto the valuesnumlines,numlines-1,numlines-2, ...,1, in succession.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!