//  Data Structures with Java by John R. Hubbard
//  Copyright McGraw-Hill, 2001
//  Example 4.2 on page 73
//  Recursive Implementation of Factorial Function


public class Ex0402
{ public static int f(int n)
  { if (n==0) return 1;  // basis
    return n*f(n-1);     // recursive part
  }

  public static void main(String[] args)
  { for (int n=0; n<10; n++)
      System.out.println("f("+n+") = "+f(n));
  }
}
