#include<stdio.h>
void
main()
{
long int n;
long int fact(long int n);
clrscr();
printf(" Enter a number: ");
scanf("%ld",&n);
printf(" Factorial of %ld is
%ld",n,fact(n));
getch();
}
long
int fact(long int i)
{
int fct=1;
for(;i>=1;i--)
fct*=i;
return fct;
}
No comments:
Post a Comment