Algorithm to find factorial of a number.

1. Start.

2. Initialize fact = 1 and i = 2 .

3. Read a number.

4. If number is negative, display appropriate message and go to step 7.

5. While i < = number. (i is less than or equal to number)
             fact = fact * i ;
             i=i+1;

6. Print factorial.

7. End.

No comments:

Post a Comment