PROGRAM ELEVEN
The factorial of an integer is the product of all integers up to and including that integer, except that the factorial of 0 is 1.
          eg,  3! = 1 * 2 * 3    (answer=6)
Evaluate the factorial of an integer less than 20, for five numbers input successively via the keyboard.

	program PROG11 (input, output);
	var  loopcount, innerloop, number, factorial : integer;
	begin
	   for loopcount := 1 to 5 do
	   begin
	      writeln;
	      writeln('Enter number ',loopcount, ' for calculation');
	      readln( number );
	      if number = 0 then factorial := 0
	      else
	      begin
	         factorial := 1;
	         for innerloop := number downto 1 do
	            factorial := factorial * innerloop
	      end;
	      writeln('The factorial of ',number,' is ',factorial)
	   end
	end.


Copyright B Brown/P Henry/CIT, 1988-1997. All rights reserved.