Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- int fib_worker(int a, int b, int n)
- {
- if (n == 0) return a;
- return fib_worker(b, a+b, n - 1);
- }
- int fibonacci(int n)
- {
- return fib_worker(0, 1, n);
- }
- int main()
- {
- printf("%d\n", fibonacci(45));
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement