Computer Science

Write an algorithm to find a factorial of an inputted number.

Algo & Flowcharts

1 Like

Answer

Step 1: Start

Step 2: Input the number "n" from the user.

Step 3: Initialize a variable "fact" to 1.

Step 4: If n is 0, then the factorial is 1 and go to Step 7.

Step 5: If "n" is greater than 0, multiply "fact" by each integer from 1 to "n" in sequence.

Step 6: The final value of "fact" is the result.

Step 7: Display "fact".

Step 8: End

Answered By

1 Like


Related Questions