c program to find factorial number


Program to find the factorial of a number
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);
}

No comments: