Write a program to calculate the factorial of a given number.

#include<stdio.h>
int main()
{
int i,n,f=1;
printf("enter the number:");
scanf("%d",&n);
for(i=1;i<=n;i++)
{
f=f*i;
}
printf("factorial of %d is %d",n,f);
}

Comments

Popular posts from this blog