//Recursion Method
#include<stdio.h>
int factorial(int num)
{
if(num==0)
return 0;
else
return num*factorial(num-1);
}
void main()
{
int result,n;
printf("Enter the Number:");
scanf("%d",n);
result=factorial(n);
printf("Factorial Number:",result);
}
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