diff options
| author | aarne <unknown> | 2004-09-25 08:51:33 +0000 |
|---|---|---|
| committer | aarne <unknown> | 2004-09-25 08:51:33 +0000 |
| commit | a6219b3a0923bd928324054611b2f65316e67978 (patch) | |
| tree | 34c636e3b6a1f098ca5ff5ea66eddfb90990640e /examples/gfcc/compiler/factorial.c | |
| parent | 5a208ce3ea26726d15e814c0498680597cca45fa (diff) | |
more examples
Diffstat (limited to 'examples/gfcc/compiler/factorial.c')
| -rw-r--r-- | examples/gfcc/compiler/factorial.c | 21 |
1 files changed, 21 insertions, 0 deletions
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 ; +} ; + |
