program arithmetic(input,output);
	var f: integer; 
	function factorial(f:integer):integer; 
		function fact(n:integer):integer; 
		begin 
			if n=1 then fact := 1 else fact := n*fact(n-1)
		end; (* end fact *) 
	begin 
		if f<=0 then factorial := 0 else factorial := fact(f)
	end; (* end factorial *)
begin 
      write('Enter number: ');
      readln(f);
      writeln(f, '! = ', factorial(f));
      readln (* just to be able to read results on console *)
end.

