Follow

Translate

Tuesday, March 15, 2016

FACTORIAL(FACT, N)

This procedure calculate N! and returns the value in the variable FACT.

1.  If N = 0, then:Set FACT : = 1, and return.

2.  Set FACT : = 1. [Initializes FACT for loo.]

3.  Repeat for K = 1 to N.
        Set FACT : = K*FACT.
[End of loop.]

4.   Return.


Procedure B: FACTORIAL(FACT, N)
This procedure calculate N! and returns the value in the variable FACT.

1.   If N = 0, then:Set FACT : = 1, and return.

2.  Call FACTRIAL(FACT, N-1)

3.    Set FACT : = K*FACT.
4.   Return.
If You want to learn about the technology, computer science & engineering, web programming, freelancing, earning please click here :CSE SOLVE

0 comments:

Post a Comment