Tuesday, March 20, 2012

C Program to find factorial of a number

Simple C Program


int main()
{
int n,i,f=1;
printf("enter any num \n");
scanf("%d",&n);
for(i=1;i<=n;i++)
{
f=f*i;
}
printf("factorial is %d ",f);
system("pause");
}

1 comment:

  1. wl u pls give me a explanation for this code?

    ReplyDelete

Google+ Followers