From a6219b3a0923bd928324054611b2f65316e67978 Mon Sep 17 00:00:00 2001 From: aarne Date: Sat, 25 Sep 2004 08:51:33 +0000 Subject: more examples --- examples/gfcc/compiler/demo.c | 9 +++++++++ examples/gfcc/compiler/demo.gif | Bin 0 -> 135673 bytes examples/gfcc/compiler/factorial.c | 21 +++++++++++++++++++++ 3 files changed, 30 insertions(+) create mode 100644 examples/gfcc/compiler/demo.c create mode 100644 examples/gfcc/compiler/demo.gif create mode 100644 examples/gfcc/compiler/factorial.c (limited to 'examples') diff --git a/examples/gfcc/compiler/demo.c b/examples/gfcc/compiler/demo.c new file mode 100644 index 000000000..d9a95d2b6 --- /dev/null +++ b/examples/gfcc/compiler/demo.c @@ -0,0 +1,9 @@ +int fact (int n) { + int f ; + f = 1 ; + while (1 < n) { + f = n * f ; + n = n - 1 ; + } + return f ; +} ; diff --git a/examples/gfcc/compiler/demo.gif b/examples/gfcc/compiler/demo.gif new file mode 100644 index 000000000..798c09170 Binary files /dev/null and b/examples/gfcc/compiler/demo.gif differ diff --git a/examples/gfcc/compiler/factorial.c b/examples/gfcc/compiler/factorial.c new file mode 100644 index 000000000..7c8fca524 --- /dev/null +++ b/examples/gfcc/compiler/factorial.c @@ -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 ; +} ; + -- cgit v1.2.3