#include<stdio.h>
#include<conio.h>
#define MAX
10000
void
factorial(int);
void
multiply(int);
int l
= 0;
int
fact[MAX];
int main(){
int n;
int i;
printf("Enter any integer number : ");
scanf("%d",&n);
fact[0]=1;
factorial(n);
printf("Factorial is : ");
for(i=l;i>=0;i--){
printf("%d",fact[i]);
}
return 0;
}
void
factorial(int n){
int i;
for(i=2;i<=n;i++){
multiply(i);
}
}
void
multiply(int n){
long i,r=0;
int
arr[MAX];
for(i=0;i<=l;i++){
arr[i]=fact[i];
}
for(i=0;i<=l;i++){
fact[i] = (arr[i]*n + r)%10;
r = (arr[i]*n + r)/10;
//printf("%d ",r);
}
if(r!=0){
while(r!=0){
fact[i]=r%10;
r= r/10;
i++;
}
}
l = i-1;
}