[ create a new paste ] login | about

Link: http://codepad.org/N2aY4IBz    [ raw code | output | fork ]

appunti2 - Perl, pasted on Apr 29:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#!/usr/bin/perl
#
# Il numero di partenza viene fornito come costante.
#
$numero = 8;
$cont = $numero -1;
# Il ciclo seguente è senza fine.
while (1)
  {
    $numero *= $cont;
    $cont--;
    if (!$cont)
      {
        last;
      }
  }
print "Il fattoriale è $numero.\n";


Output:
1
Il fattoriale è 40320.


Create a new paste based on this one


Comments: