forked from GitHub/gf-core
more examples
This commit is contained in:
9
examples/gfcc/compiler/demo.c
Normal file
9
examples/gfcc/compiler/demo.c
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
int fact (int n) {
|
||||||
|
int f ;
|
||||||
|
f = 1 ;
|
||||||
|
while (1 < n) {
|
||||||
|
f = n * f ;
|
||||||
|
n = n - 1 ;
|
||||||
|
}
|
||||||
|
return f ;
|
||||||
|
} ;
|
||||||
BIN
examples/gfcc/compiler/demo.gif
Normal file
BIN
examples/gfcc/compiler/demo.gif
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 132 KiB |
21
examples/gfcc/compiler/factorial.c
Normal file
21
examples/gfcc/compiler/factorial.c
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
int fact (int n) {
|
||||||
|
int f ;
|
||||||
|
f = 1 ;
|
||||||
|
{
|
||||||
|
while (1 < n) {
|
||||||
|
f = n * f ;
|
||||||
|
n = n - 1 ;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return f ;
|
||||||
|
} ;
|
||||||
|
|
||||||
|
int main () {
|
||||||
|
int n ;
|
||||||
|
n = 1 ;
|
||||||
|
{
|
||||||
|
while (n < 11) printf(int,fact(n)) ; n = n+1 ;
|
||||||
|
}
|
||||||
|
return ;
|
||||||
|
} ;
|
||||||
|
|
||||||
Reference in New Issue
Block a user