遞迴_費式數列

 avatar
user_3763047219
c_cpp
a year ago
262 B
1
Indexable
Never
int fibr(int n);

int fibr(int n) {
    if (n == 0 || n == 1) {
        return 1;
    }
    else {
        return fibr(n-1) + fibr(n - 2);
    }
}

#include <stdio.h>


int main() {
    int n;
    scanf("%d", &n);
    printf("%d", fibr(n));

}