Calculate factorial of any number upto 25000

#include<stdio.h>
#include<conio.h>
unsigned long int num(unsigned long int a[],unsigned long int p)
{
unsigned int j;
for(j=0;p!=0;j++)
{
a[j]=p%10;
p=p/10;
}
return j;
}
unsigned long int fact(unsigned long int a[], unsigned long int n, unsigned long int j)
{
unsigned long int k,q=0,x;
for(k=0;k<j;k++)
{
x=a[k]*n+q;
a[k]=x%10;
q=x/10;
if(k==j-1&&q==0)
return j;
}
x=x/10;
while(x!=0)
{
a[k]=x%10;
x=x/10;
k++;
}
k--;
return k+1;
}
void factorial(unsigned long int n)
{
unsigned long int p,j,x,a[99999];
p=n;
a[0]=1;
j=num(a,n);
int i=0;
while(n>2)
{
n--;
j=fact(a,n,j);
}
printf("\nFactorial of %u :-\n",p);
if(p==0)
printf("%u",a[0]);
if(j>10)
{
printf("%u.",a[j-1]);
for(x=j-2;x>=j-10;x--)
printf("%u",a[x]);
printf(" e%u",j-1);
}
else
for(x=j-1;x>=0;x--){
if(x==-1)
break;
printf("%u",a[x]);}
}
int main()
{
unsigned long int n;
char x;
puts("::\tWelcome Here\t::");
puts("\nYou can calculate the factorial here from 0 to 25000");
puts("\nEnter the number");
scanf("%u",&n);
puts("\nCalculating.........");
factorial(n);
puts("\n\nCalculation done !");
puts("Thank You");
return 0;
}

Comments