How to find the factorial of …
CBSE, JEE, NEET, CUET
Question Bank, Mock Tests, Exam Papers
NCERT Solutions, Sample Papers, Notes, Videos
Posted by Gitanshu Singh 4 years, 8 months ago
- 1 answers
Related Questions
Posted by Payal Kumari 1 year, 5 months ago
- 0 answers
Posted by Manasvi Bhutada 1 year, 2 months ago
- 1 answers
Posted by M.Sameeha _ 1 year, 1 month ago
- 0 answers
Posted by Catherine Tympuiñ 1 year, 1 month ago
- 0 answers
Posted by Rupesh Rupesh 1 year, 6 months ago
- 2 answers
Posted by Jeevesh Jeevesh 1 year, 2 months ago
- 1 answers
Posted by Catherine Tympuiñ 1 year, 1 month ago
- 1 answers
Posted by Vanshika Prajapati 1 year, 6 months ago
- 1 answers
myCBSEguide
Trusted by 1 Crore+ Students
Test Generator
Create papers online. It's FREE.
CUET Mock Tests
75,000+ questions to practice only on myCBSEguide app
Gaurav Seth 4 years, 8 months ago
The factorial of a number is the product of all the integers from 1 to that number.
For example, the factorial of 6 is <code>1*2*3*4*5*6 = 720</code>. Factorial is not defined for negative numbers, and the factorial of zero is one, <code>0! = 1</code>.
Source Code
<pre> <code># Python program to find the factorial of a number provided by the user. # change the value for a different result num = 7 # To take input from the user #num = int(input("Enter a number: ")) factorial = 1 # check if the number is negative, positive or zero if num < 0: print("Sorry, factorial does not exist for negative numbers") elif num == 0: print("The factorial of 0 is 1") else: for i in range(1,num + 1): factorial = factorial*i print("The factorial of",num,"is",factorial) </code></pre>Output
<pre> <samp>The factorial of 7 is 5040 </samp></pre>0Thank You