Advertisement
atm-irbis

Factorial (iterative)

May 27th, 2012
3,460
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Icon 0.16 KB | None | 0 0
  1. procedure main()
  2. local a,b
  3. a:=read()
  4. b:=factorial(a)
  5. write(b)
  6. end
  7.  
  8. procedure factorial(n)
  9. local p,i
  10. p:=1
  11. every i:=1 to n do {
  12.  p:=p*i
  13. }
  14. return p
  15. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement