Hi, I have this factorial function that I have working just great, but I am not really sure how I am supposed to print the local variable and the recursive call parameter. Any help would be greatly appreciated! Thanks.
#include <iostream>
using std::cout;
using std::endl;
#include<iomanip>
using std::setw;
unsigned long factorial(unsigned long);
int main()
{
for (int counter = 0; counter <= 10; counter++)
cout<< setw(2) << counter <<" ! = "<<factorial(counter)<<endl;
return 0;
}
unsigned long factorial(unsigned long number)
{
if (number <= 1)
return 1;
else
return number * factorial(number - 1);
cout<<number<<endl;
}