c program factorial of number

program:
#include<stdio.h>
int main()
{
 int number,factorial=1,i;
 printf("Enter a number to calculate it's factorial: \n");
 scanf("%d",&number);
 for(i=1;i<=number;i++)
{
 factorial=factorial*i;
}
 printf("%d!=%d\n",number,factorial);
 return 0;
}
output:
Previous Post Next Post