Pseudocode and Algorithm for Finding Factorial of a Number

(1703 Views)


What is Factorial of a number?

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.

Pseudocode and Algorithm for Finding Factorial of a Number

Algorithm for Finding Factorial of a Number

Step 1: Start Step 2: Declare Variable n, fact, i Step 3: Read number from User Step 4: Initialize Variable fact=1 and i=1 Step 5: Repeat Until i<=number 5.1 fact=fact*i 5.2 i=i+1 Step 6: Print fact Step 7: Stop

Pseudocode for Finding Factorial of Number

Read number Fact = 1 i = 1 WHILE i<=number Fact=Fact*i i=i+1 ENDWHILE WRITE Fact

We first take input from user and store it in variable n. Then we initialize a variable Fact with value 1 and variable i with value 1. Repeat next two steps until i is less than n.
1. Multiply Fact with current value of i
2. Increment i with 1 At last, print the value of Fact.

        

Solution Didn't Worked 6 DownvotesDownvote



Comments

1 comment
  • Prashanth

    Super definition awesome I am intelligent so I can able to understand this concept .



Search