1
1
mirror of https://github.com/theoludwig/programming-challenges.git synced 2024-12-08 00:45:29 +01:00
programming-challenges/challenges/fibonacci/solutions/c/function/solution.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;
}