Computer Science
Write an algorithm to find a factorial of an inputted number.
Algo & Flowcharts
2 Likes
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
Write an algorithm that accepts four numbers as input and find the largest and smallest of them.
Write the pseudocode to print the bill depending upon the price and quantity of an item. Also, print Bill GST, which is the bill after adding 5% tax in the total bill.
"Decomposition leads to simplicity." How?
Match the pairs: