Find the Factorial in C Program

How to write a c program to find the factorial of a number in C programming ?


Solution:
#include <stdio.h>

int main()
{
int n, i;
int factorial = 1;

printf("Enter the number: ");
scanf("%d", &n);

for(i = 1; i <= n; i++)
factorial *= i;

printf("%d", factorial);

return 0;
}


Learn More :