#include <iostream>
using namespace std;
int factorial(int);
int main()
{
int number=5;
int fact;
fact = factorial(number);
cout << fact;
cin.get();
return 0;
}
int factorial(int number)
{
if(number<=1)
{
return 1;
}
else
return number+factorial(number-1);
}
Thursday, 24 January 2013
recursive factorial
08:27
ATEEK
No comments
0 comments:
Post a Comment