Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- int fib(int n);
- int main()
- {
- int wej;
- puts("Ktory wyraz z ciagu Fibonacciego podac?\n");
- scanf("%d",&wej);
- printf("%d",fib(wej));
- return 0;
- }
- int fib(int n)
- {
- if(n == 0) return 0;
- if(n == 1) return 1;
- return fib(n-1)+fib(n-2);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement