Files
gf-core/examples/gfcc/compiler/factorial.c
2004-09-28 19:44:02 +00:00

39 lines
408 B
C

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 ;
} ;