Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- int fib(int n) {
- if(n == 1) return 0;
- if(n == 2) return 1;
- return fib(n-1) + fib(n-2);
- }
- void main() {
- int n;
- scanf("%d", &n);
- printf("Enesimo termo da sequencia de Fibonacci: %d\n", fib(n));
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement