Search This Blog


C Program to find Factorial of Number

/* Factorial upto 19! */


long long fact(int n)
    int i;
    long long result = 1;
        result *= i;
    return result;

int main()
    int i,n;
    while(scanf("%d",&n) == 1)
        if(n == 0)printf("1\n");
        else printf("%lld\n",fact(n));

1 comment:

  1. Hey, I also have a very interesting program to calculate the factorial of any number, no matters whether the number is very large, like if you wish to calculate the factorial of 500, my program will calculate it, and even it gives each and every digit of the result. for details and source code visit
    hope you would like it.
    You can find some other simple programs for factorial on the following links:-