OCJP

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();

}

Output

Leave a Reply

Your email address will not be published. Required fields are marked *


× How can I help you?