#!/perl -w
# NAME: factorial.pl
# AIM: Take an input of an integer, and show the factorial of that number.
# 
use strict;
use warnings;
use bignum;
require 'logfile.pl' or die "Unable to load logfile.pl ...\n";
# log file stuff
my ($LF);
my $outfile = 'temp.'.$0.'.txt';
if ($0 =~ /\w{1}:\\.*/) {
	my @tmpsp = split(/\\/,$0);
	$outfile = 'temp.'.($tmpsp[-1]).'.txt';
}
open_log($outfile);
prt( "$0 ... Hello, World ...\n" );

my $dbg1 = 0;
my $def_input = 1000;
my $input = $def_input;

my $result = 1;
for (my $i = 1; $i <= $input; $i++ ) {
	$result *= $i;
	prt( "$i $result ...\n" ) if ($dbg1);
}
prt( "Factorial $input = $result ...\n" );

close_log($outfile,1);
exit(0);

# eof
