Question

If n is an integer greater than 0, n factorial (n!) is the product: n* (n-1)...

If n is an integer greater than 0, n factorial (n!) is the product: n* (n-1) * (n-2) * ( n-3)… * By convention, 0! = 1. You must write a program that allows a user to enter an integer between 1 and 7. Your program must then compute the factorial of the number entered by the user. Your solution MUST actually perform a computation (i.e., you may not simply print “5040” to the screen as a literal value if the input is 7). design a flowchart and pseudocode for the following question.

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Code


n = int (input ('Enter an integer between 1 and 7: '))
F = 1
for M in range (1, n + 1) :
F *= M
print ('%d! = %d' % (n, F))

output

code snaps

flowChart

Pseudocode for Factorial of a number :

Step 1: Declare M and F as integer variable.

Step 2: Initialize F=1 M=1.

Step 2: Enter the value of N.

Step 3: Check whether N Between 1 and 7.

Step 4: If yes then, F=F*N

Step 5: Increament the value of M by 1 .

Step 6: Repeat step 4 and 5 until N==M.

Step 7: Now print the value of F.

If you have any query regarding the code please ask me in the comment i am here for help you. Please do not direct thumbs down just ask if you have any query. And if you like my work then please appreciates with up vote. Thank You.

Add a comment
Know the answer?
Add Answer to:
If n is an integer greater than 0, n factorial (n!) is the product: n* (n-1)...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT