Some programming languages allow calculation of values at compile time.



Task

Calculate    10!    (ten factorial)   at compile time.

Print the result when the program is run.

Discuss what limitations apply to compile-time calculations in your language.




tenfactorial equ 10*9*8*7*6*5*4*3*2
 
MOVE.L #tenfactorial,D1  ;load the constant integer 10! into D1
LEA tenfactorial,A1      ;load into A1 the memory address 10! = 0x375F00
ADD.L #tenfactorial,D2   ;add 10! to whatever is stored in D2 and store the result in D2