/* * Program to compute elements of the Fibonacci sequence using recursion. * * (not efficient, but simple!) */ #include long fib(int a); int main(void) { int n; printf("enter n\n"); if (scanf("%d", &n) != 1) { printf("not number\n"); return 1; } printf("fib(%d) is %ld\n", n, fib(n)); return 0; } long fib(int a) { if (a <= 1) return 1; else return fib(a-1) + fib(a-2); }