#include<iostream>
using namespace std;


// Precondition: input is a non-negative integer
// Postcondition: output is factorial of the input,
// i.e., factorial(num)=num x (num-1) x (num-2) x ... x 2 x 1
int factorial(int num);


int main()
{
 int numInput;


 // Get number input
 cout << "Give me a number: ";
 cin >> numInput;


 // Report factorial of number input
 cout << numInput << "! = " << factorial(numInput)
      << endl;


 return 0;
}


// Calculate factorial of input
int factorial(int num)
{
 if(num==0)  // Base case
   return 1;
 else        // Recursive call
   return num*factorial(num-1);
}