fork download
  1. #include<stdio.h>
  2. int main(void)
  3. {
  4. int i=0,j=0,fact[20000],k=0,l=0,n=0,temp=0;
  5.  
  6. fact[0]=1;
  7. l=1;
  8. printf("enter value: ");
  9. scanf("%d",&n);
  10. for(i=2;i<=n;i++)
  11. {
  12. for(j=0;j<l;j++)
  13. {k=temp+i*fact[j];
  14. fact[j]=k%10;
  15. temp=k/10;
  16. }
  17. while(temp>0)
  18. {
  19. fact[l++]=temp%10;
  20. temp=temp/10;
  21. }
  22. }
  23. for(i=l-1;i>-1;i--)
  24. printf("%d",fact[i]);
  25.  
  26. printf("\npress any key to exit.... ");
  27. getchar(); //On windows change this line to getch();
  28. return 0;
  29. }
  30.  
Success #stdin #stdout 0s 9416KB
stdin
Standard input is empty
stdout
enter value: 1
press any  key to exit....