Your Only Destination To Empower Your Computer Programing Knowledge. Sky is not so high, You can Touch it if You Try

Finding factorial of a number:Algorithm,Flowchart

This article is about find factorial of a number.Before any discussion we should know what is factorial?
Factorial of a number=number!
Ex.factorial of 6!=6*5*4*3*2*1=120
factorial of 0!=1
Algorithm and flowchart:-In previous articles Algorithm of roots of polynomial equation and flowchart of roots of polynomial equation we discuss algorithm and flowchart of square roots of polynomial equation.I think you get some idea about algorithm and flowchart from previous articles.for more understanding about the concept we discuss factorial of a number.
Problem:Finding factorial of a number n
Algorithm:-
Step:1 Start
Step:2 Read a number n
Step:3 if(n<0)
write"factorial of negative numbers is not possible" and exit
(end of if statement)
Step:4 if(n=0)
write"factorial of 0=1" and exit
Step:5 fact=1
for(m=1;m<=n;m++)
{
fact= fact*m
}
Step:6 write"factorial".
Step:7 Stop

flowchart:-
flowchart of factorial of a number n

Friends,
I think you will get something from this.If there is any wrong concept then please highlight it.As no one is perfect.Thanks for visit...........stay in touch.

6 comments:

  1. Thankx it helped me a lot doing my cs project....

    ReplyDelete
  2. can you write a flow chart using addition and multiplication to find m^n where m and n are input by the user?

    ReplyDelete
  3. factorial logic correct but example is wrong.
    6!=6*5*4*3*2*1=720
    0!=0
    1!=1
    2!=2
    3!=6
    4!=24
    5!=120
    6!=720

    ReplyDelete