Below is a simple C program to calculate the factorial of a given number. The factorial of a non-negative integer n is the product of all positive integers less than or equal to n. The factorial is denoted by ‘n!
‘.
Program :
#include<stdio.h>
#include<conio.h>
int main()
{
int i,n,fact=1;
printf(“Enter a number : “);
scanf(“%d”,&n);
for(i=1;i<=n;i++)
{
fact=fact*i;
}
printf(“Factorial of %d is : %d\n”,n,fact);
Â
}