SOURCE FILE: factorialB.cpp


/* This is a little program that exercises a RECURSIVE
   function that calculates factorials. */

#include <iostream.h>

int factorialB (int N)
{
  if (N<2) return 1;
  else return N*factorialB(N-1);
}

int main ()
{
  cout << "Factorial(0) is: " << factorialB(0) << endl ;
  cout << "Factorial(1) is: " << factorialB(1) << endl ;
  cout << "Factorial(2) is: " << factorialB(2) << endl ;
  cout << "Factorial(3) is: " << factorialB(3) << endl ;
  cout << "Factorial(4) is: " << factorialB(4) << endl ;
  cout << "Factorial(5) is: " << factorialB(5) << endl ;
  cout << "Factorial(6) is: " << factorialB(6) << endl ;
  return 0 ;
}