(9274 Views)
Product of all consecutive Integer numbers upto n is called Factorial of a Number and is denoted by n!. For Example, the value of 5! is 120.
We first take input from user and store that value in variable named “n”. Then we initialize a variable “Fact” with value 1 (i.e Fact=1) and variable i with value 1(i.e i=1). Repeat next two steps until i is less than n.
Let’s take an example,
Let the input be 5.
The equation that gets created by our algorithm is 5x4x3x2x1.
So, The Factorial of 5 is 120(5x4x3x2x1).
21 UpvotesUpvote |
8 DownvotesDownvote |
Super definition awesome I am intelligent so I can able to understand this concept .