We also have initialized another variable factorial as 1. This variable is to hold the final factorial. Inside the loop, on each iteration, we are multiplying the current value of i with factorial. Once the loop will end, factorial will hold the factorial of the given number .
For More Information Please Refer:
You May Also Like to Read: