restored gfcc example (GF C compiler)

This commit is contained in:
aarne
2010-03-02 19:10:56 +00:00
parent 46c04f4c91
commit 1be8903cce
15 changed files with 2169 additions and 0 deletions

38
examples/gfcc/factorial.c Normal file
View File

@@ -0,0 +1,38 @@
int fact (int n) {
int f ;
f = 1 ;
{
while (1 < n) {
f = n * f ;
n = n - 1 ;
}
}
return f ;
} ;
int factr (int n) {
int f ;
{
if (n < 2) {
f = 1 ;
}
else {
f = n * factr (n-1) ;
}
}
return f ;
} ;
int main () {
int n ;
n = 1 ;
{
while (n < 11) {
printf("%d",fact(n)) ;
printf("%d",factr(n)) ;
n = n+1 ;
}
}
return ;
} ;