UNB/ CS/ David Bremner/ teaching/ java/ Fac.java
public class Fac
{  public static void main(String[] args)
   {  ConsoleReader console = new ConsoleReader(System.in);
      System.out.println("Please enter a number:");
      int n = console.readInt();
      System.out.println(n + "! = " + factorial(n));
   }

   /**
      Computes the factorial of an integer.
      @param n an integer >= 0
      @return n!
   */
   public static int factorial(int n)
   {  if (n == 0)
         return 1;
      else
      {  int result = n * factorial(n - 1);
         return result;
      }
   }
}