Factorial of a number in Perl

Perl Program to find the factorial of a number

Source code :

$number = 5; # Change the number here 

$fact = 1;

for( $i = 1; $i <= $number ; $i=$i+1 ){
    $fact = $fact*$i;
}

print "Factorial of $number is: $fact"

Output :

Factorial of 5 is: 120

Output :


                

Comments :