1
1
mirror of https://github.com/theoludwig/programming-challenges.git synced 2024-11-09 22:08:58 +01:00
programming-challenges/challenges/fibonacci/solutions/c/function/solution.c

14 lines
294 B
C

#include <stdio.h>
#include <stdlib.h>
unsigned long fibonacci(unsigned long number) {
return number < 2 ? number : fibonacci(number - 1) + fibonacci(number - 2);
}
int main() {
unsigned long number;
scanf("%lu", &number);
printf("%lu\n", fibonacci(number));
return EXIT_SUCCESS;
}