I'm sharing this code because it was my examination question on final year of computer Science, Heritage Polytechnic Eket Akwa Ibom State, here in Nigeria.
I have seen this question a lot of time been asked an there is no appropriate answer to it, so i wrote this lines of code in pascal to solve this long time mind troubling question.
You will learn to calculate the factorial of a number using for loop in this example.
Therefore, This example uses nested for loop function in pascal. this pascal program generates factorial.
The factorial of a positive number n is given by:
factorial of n (n!) = 1*2*3*4....n
Example: Factorial of a Number In Pascal
This program takes a positive integer from the user and computes factorial using for loop.