riccardinofuffolo

Sistemi Operativi - 07/02/2003 - Es. 5

Aug 15th, 2012
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Awk 0.29 KB | None | 0 0
  1. #!/bin/awk -f
  2. # Tema d'esame 07/02/2003 (www.labinf.polito.it/whitone/index.php?summ=SO)
  3. # Uso: cat numeri.txt | awk -f fattoriale.awk
  4. # 14/08/2012 - BNCRCR
  5. {
  6.     fattoriale = 1
  7.     for (i = $1; i >= 1; i--)
  8.         fattoriale *= i
  9.     print fattoriale
  10. }
  11.  
  12. # == numeri.txt ==
  13. # 1
  14. # 3
  15. # 5
  16. # 0
  17. # 2
Advertisement
Add Comment
Please, Sign In to add comment