How to write a C Program to find the factorial of a number in C Programming Language ?
Solution of C Program:
#include<stdio.h>
void main()
{
int x, n, fact;
printf("\nEnter the value of n : ");
scanf("%d", &n);
x = 1;
fact = 1;
while(x <= n)
{
fact*=x;
x++;
}
printf("\nThe Factorial of a Number is : %d.", fact);
}
You may also learn these C Program/Code :