factorial of a number in python

Today, We want to share with you factorial in python.In this post we will show you factorial of a number in python, hear for factorial program in python without recursion we will give you demo and example for implement.In this post, we will learn about prime number in python with an example.

Python Program to Find the Factorial of a Number

given_num = 6

fact_num = 1

if given_num < 0:
    print("sorry, factorial of a number is not exist of the negative numbers.")
elif given_num == 0:
    print("Your input number is 0 or 1 for factorial")
    for i in range(1, given_num + 1):
        fact_num = fact_num*i
        print("the factorial of ", given_num , "is", fact_num )    


the factorial of  6 is 1
the factorial of  6 is 2
the factorial of  6 is 6
the factorial of  6 is 24
the factorial of  6 is 120
the factorial of  6 is 720

I hope you get an idea about factorials in python using for loop.
I would like to have feedback on my infinityknow.com blog.
Your valuable feedback, question, or comments about this article are always welcome.
If you enjoyed and liked this post, don’t forget to share.

Read Also:  How to sort a string alphabetically in Python?

About Pakainfo

I am Jaydeep Gondaliya, a software engineer, the founder and the person running Pakainfo. I'm a full-stack developer, entrepreneur and owner of Pakainfo.com. I live in India and I love to write tutorials and tips that can help to other artisan, a Passionate Blogger, who love to share the informative content on PHP, Javascript, JQuery, Laravel, Codeigniter, VueJS, AngularJS and Bootstrap from the early stage.

View all posts by Pakainfo →

Leave a Reply

Your email address will not be published. Required fields are marked *