-- This program calculates factorial
-- Author: John Weber
with Ada.Text_Io, Ada.Integer_Text_Io;
use Ada.Text_Io, Ada.Integer_Text_Io;
-- Ada 95: From The Beginning
-- Chapter 2, Problem 2
procedure Ch2Problem2 is
   N : Integer := 0;
   function Factorial(N:Integer) return Integer is
   begin
      if( N <= 0 ) then
         return 1;
      else
         return( N * Factorial(N-1));
      end if;
   end Factorial;
begin
   Put("Enter N: ");
   Get(N);
   Put(Factorial(N)); New_Line;
end Ch2Problem2;
