2022-02-12 23:04:53 -05:00
|
|
|
long factorial(long x) {
|
|
|
|
return x ? x * factorial(x - 1)
|
|
|
|
: 1;
|
2022-02-12 21:27:57 -05:00
|
|
|
}
|
|
|
|
|
2022-02-12 23:04:53 -05:00
|
|
|
long fibonacci(long x) {
|
|
|
|
return x ?
|
|
|
|
x-1 ?
|
|
|
|
fibonacci(x-1) + fibonacci(x-2)
|
|
|
|
: 1
|
|
|
|
: 0;
|
2022-02-12 21:27:57 -05:00
|
|
|
}
|
|
|
|
|
2022-02-12 23:04:53 -05:00
|
|
|
int main(int argc, char **argv) {
|
|
|
|
return fibonacci(30);
|
2022-02-09 22:44:27 -05:00
|
|
|
}
|
2022-02-12 21:27:57 -05:00
|
|
|
|