menu search
brightness_auto
more_vert
2 1

Write a program to find the factorial of a number

Topic Python Programming
Type Python Program
Class 10
thumb_up_off_alt 2 like thumb_down_off_alt 0 dislike

1 Answer

more_vert
0

num = int(input("Enter a number: "))    

factorial = 1    

if num < 0:    

   print(" 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)


Study more about Python at Python Class 10

thumb_up_off_alt 0 like thumb_down_off_alt 0 dislike

Related questions

thumb_up_off_alt 3 like thumb_down_off_alt 0 dislike
1 answer
thumb_up_off_alt 3 like thumb_down_off_alt 0 dislike
1 answer
thumb_up_off_alt 3 like thumb_down_off_alt 0 dislike
1 answer
thumb_up_off_alt 4 like thumb_down_off_alt 0 dislike
0 answers
thumb_up_off_alt 3 like thumb_down_off_alt 0 dislike
0 answers
thumb_up_off_alt 2 like thumb_down_off_alt 0 dislike
1 answer
thumb_up_off_alt 3 like thumb_down_off_alt 0 dislike
1 answer
thumb_up_off_alt 3 like thumb_down_off_alt 0 dislike
1 answer
thumb_up_off_alt 3 like thumb_down_off_alt 0 dislike
0 answers
thumb_up_off_alt 2 like thumb_down_off_alt 0 dislike
1 answer
Welcome to Aiforkids, where you can ask questions and receive answers from other members of the community.

AI 2024 Class 10 Board Exams mein 100% laane ka plan OPEN NOW

Class 10 Complete One Shot AI Lectures at - Youtube
...