mirror of
https://github.com/theoludwig/programming-challenges.git
synced 2024-12-08 00:45:29 +01:00
14 lines
262 B
C
14 lines
262 B
C
|
#include <stdio.h>
|
||
|
#include <stdlib.h>
|
||
|
|
||
|
int fibonacci(int number) {
|
||
|
return number < 2 ? number : fibonacci(number - 1) + fibonacci(number - 2);
|
||
|
}
|
||
|
|
||
|
int main() {
|
||
|
int number;
|
||
|
scanf("%d", &number);
|
||
|
printf("%d\n", fibonacci(number));
|
||
|
return EXIT_SUCCESS;
|
||
|
}
|