Saturday, August 6, 2016

Factorial Number in Perl

A simple program that I wrote using Perl  to display the factorial value of the number.

Add me at Facebook my address is jakerpomperada@gmail.com and jakerpomperada@yahoo.com.

My mobile number here in the Philippines is 09173084360.



Sample Program Output

Program Listing

my @factorial = (1);
    $MAX_VALUES=6;
    for my $number (1..$MAX_VALUES) {
        $factorial[$number] = $number * $factorial[$number-1];
    }

    print "\n\n";
    print "\tFactorial Program in Perl";
    print "\n\n";
    for my $values(1..$MAX_VALUES)
    {
    print "The factorial value of $values is $factorial[$values].\n"  ;
  }
   print "\n\n";
   print "\t End of Program";
   print "\n\n";
   


No comments:

Post a Comment