lang-bootstrap/05/main.c

39 lines
361 B
C
Raw Normal View History

long factorial(long x) {
2022-02-13 11:24:30 -05:00
return x > 0 ? x * factorial(x - 1)
: 1;
2022-02-12 21:27:57 -05:00
}
long fibonacci(long x) {
2022-02-13 11:24:30 -05:00
return x > 0 ?
x > 1 ?
fibonacci(x-1) + fibonacci(x-2)
: 1
: 0;
2022-02-12 21:27:57 -05:00
}
int main(int argc, char **argv) {
2022-02-13 11:59:18 -05:00
float f = 3.7;
int i = 37;
f--;
++i;
--f;
++f;
f++;
--i;
f--;
++i;
--f;
++f;
f++;
--i;
f--;
++i;
--f;
++f;
f++;
--i;
return f;
2022-02-09 22:44:27 -05:00
}
2022-02-12 21:27:57 -05:00