1 2 3 4 5 6 7 8 9 10 11 12
#!/usr/bin/perl # # Il numero di partenza viene fornito come costante. # $numero = 5; $cont = $numero -1; while ($cont) { $numero *= $cont; $cont--; } print "Il fattoriale è $numero.\n";
1
Il fattoriale è 120.