#include <iostream>
using std::cout;
using std::endl;
#include <iomanip>
using std::setw;
unsigned long factorial( unsigned long ); // function prototype
int main()
{
for ( int counter = 0; counter <= 50; 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 );
}
|