In the following example, we will find a factorial of a number 6.
int num =6;
int i =1;
int factorial = 1;
for(i=1; i<=num; i++)
factorial *= i;
printf("Factorial of %d: %d", num, factorial);
elseprintf("Factorial of 0: 0");