A blog to help students to learn programming in various languages including C, C++, Java, Python and many more.

Subscribe For Free Latest Updates!

We'll not spam mate! We promise.

Friday 8 July 2016



In mathematics, the factorial of a non-negative integer n, denoted by n!, is the product of all positive integers less than or equal to n. For example,

5! = 5  *  4  *  3  *  2  * 1 = 120.
The value of 0! is 1, according to the convention for an empty product.

The factorial operation is encountered in many areas of mathematics, notably in combinatorics, algebra, and mathematical analysis. Its most basic occurrence is the fact that there are n! ways to arrange n distinct objects into a sequence (i.e., permutations of the set of objects). This fact was known at least as early as the 12th century, to Indian scholars. Fabian Stedman in 1677 described factorials as applied to change ringing.

Information source: wikipedia.org


Program:->

Program Output
Output

f = 1
x = input("Enter a number: ")
for i in range(1,x+1):
    f = f * i
print "Factorial: %d" % f

0 comments :

Post a Comment



Copyright © 2016 - ProgrmIt - All Rights Reserved
(Articles Cannot Be Reproduced Without Author Permission.)
Design By : | Powered By: Blogger