// recursiveFactorial.cc P. Conrad 09/23/05
// compute factorial with recursion
// using unsigned int instead of int

#include <iostream>
using namespace std;


int absoluteValue(int x)
{
  return x < 0 ? -x : x;
}

unsigned int factorial(unsigned int x)
{
  // recursive factorial

  if (x == 0)
    {
#ifdef DEBUG
      cout << "I'm in the if x==0 part"  << endl;
#endif
      return 1;
    }
  else
    {
#ifdef DEBUG
      cout << "I'm in the else part, x = " << x << endl;
#endif
      return x * factorial(x-1); 
    }
}

unsigned int main(void)
{
  unsigned int x;

  cout << "Enter x: ";
  cin >> x;

  cout << "x! is : " << factorial(x) << endl;

  return 0;

}

