2016 Update
This commit is contained in:
parent
948b86eafa
commit
dcf5d15da3
7965 changed files with 139854 additions and 31002 deletions
|
|
@ -1,3 +1,10 @@
|
|||
Some programming languages allow calculation of values at compile time. For this task, calculate 10! at compile time. Print the result when the program is run.
|
||||
Some programming languages allow calculation of values at compile time.
|
||||
|
||||
|
||||
;Task:
|
||||
Calculate <big> 10! </big> (ten factorial) at compile time.
|
||||
|
||||
Print the result when the program is run.
|
||||
|
||||
Discuss what limitations apply to compile-time calculations in your language.
|
||||
<br><br>
|
||||
|
|
|
|||
|
|
@ -0,0 +1,6 @@
|
|||
#include <stdio.h>
|
||||
const int val = 2*3*4*5*6*7*8*9*10;
|
||||
int main(void) {
|
||||
printf("10! = %d\n", val );
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -1,3 +1,6 @@
|
|||
/*REXX program to compute 10!*/ say '10! =' !(10); exit
|
||||
/*REXX program computes 10! (ten factorial) during REXX's equivalent of "compile─time". */
|
||||
|
||||
!: procedure; !=1; do j=2 to arg(1); !=!*j; end; return !
|
||||
say '10! =' !(10)
|
||||
exit /*stick a fork in it, we're all done. */
|
||||
/*──────────────────────────────────────────────────────────────────────────────────────*/
|
||||
!: procedure; !=1; do j=2 to arg(1); !=!*j; end /*j*/; return !
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue