Important Notice:

Factorial of a Number

Factorial of a Number

4 views 1 min read
Factorial of a Number :- Question:-

Write an algorithm and flowchart to find the factorial of a given number.

किसी दिए गए Number का Factorial ज्ञात करने के लिए Algorithm और Flowchart लिखिए।

Example:-

N = 5

Factorial = 5 × 4 × 3 × 2 × 1 = 120

Logic / Explanation:-

FACT = 1 → Store the factorial result.

FACT = FACT × i → Multiply the current result by i.

i = i + 1 → Increase the value of i by 1.

Solution:- Algorithm:-

Step 1: Start
Step 2: Input a number N.
Step 3: Set FACT = 1.
Step 4: Set i = 1.
Step 5: Set FACT = FACT × i.
Step 6: Set i = i + 1.
Step 7: Repeat Steps 5 and 6 while i <= N.
Step 8: Display FACT.
Step 9: Stop.

 
 
 
 

Related Notes