Simple Factorial
#include<stdio.h>
#include<conio.h>
void main()
{
int i,n;
long fac=1;
clrscr();
printf("\nEnter N :");
scanf("%d",&n);
for(i=1;i<=n;i++)
{
//printf("\n%d",i);
fac*=i;
}
printf("\nfac of %d is %ld ",n,fac);
getch();
}
From Basic to the Best
#include<stdio.h>
#include<conio.h>
void main()
{
int i,n;
long fac=1;
clrscr();
printf("\nEnter N :");
scanf("%d",&n);
for(i=1;i<=n;i++)
{
//printf("\n%d",i);
fac*=i;
}
printf("\nfac of %d is %ld ",n,fac);
getch();
}