/* Factorial upto 19! */

#include<stdio.h>

long long fact(int n)

{

int i;

long long result = 1;

clrscr();

long long fact(int n)

{

int i;

long long result = 1;

clrscr();

for(i=n;i>1;i--)

result *= i;

return result;

}

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));

}

getch();

}

## 1 Comments

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 http://codingloverlavi.blogspot.in/2013/03/here-is-one-more-interesting-program.html

ReplyDeletehope you would like it.

You can find some other simple programs for factorial on the following links:-

http://codingloverlavi.blogspot.in/2013/05/recursive-program-for-factorial.html

http://codingloverlavi.blogspot.in/2013/05/factorial-calculation-without-any.html