Factorial

[Table of Contents] | [ Disk Image

From page 81 of the Action! Language Reference Manual.


PROC factorials()

;**** This procedure will print out the factorials
;up to some specified number (the variable 'amt')
   CARD fact=[1],  ;the factorial of 'num'
        num=[1],   ;the counter
        amt=[6000] ;the upper bound of testing
   Print("Factorials less than ")
   PrintC(amt)     ;prints the upper bound
   PrintE(":")     ;print a ':' and carriage return
   PutE()          ;prints a carriage return
   WHILE fact*num < amt  ;test next factorial
      DO                 ;start of WHILE loop
      fact==*num
      PrintC(num)        ;print the number
      Print(" factorial is ")
      PrintCE(fact)      ;print number's factorial
      num==+1            ;increament number
      OD                 ;end of WHILE loop
   RETURN   ;end of PROC factorials




Comments

Popular posts from this blog

Superhop ACTION!

ANALOG MAN

Guessing Game 1