1.Algorithm of find the Factorial Number:
1.Start
2. (Input)Read N
3. Set
Product=1
Mult=N
4.(Repeat This
While(Mult<=1)
5.Product=Product Mult(Partial Product)
6.Mult=Mult-1(End of
7.(output) Write factorial of N product.
8. End.
2.Algorithm Of Fibonacci Number:
Fibonacci(n)
{
If(n<=1) Then
Write(n)
Else
{
fnm1=0; fnm2=1;
for(i=2 to n do)
{
fn=fnm1+fnm2
fnm1=fnm2
fnm2=fn
write(fn);
}
}
No comments:
Post a Comment