loading
main.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#include <stdio.h>
 
int f(int);
 
int main(void) {
  int n = 10, i = 0, c;
  printf("Fibonacci series terms are:\n");
  for (c = 1; c <= n; c++) {
    printf("%d\n", f(i));
    i++;
  }
  return 0;
}
 
int f(int n) {
  if (n == 0 || n == 1)
    return n;
  else
    return (f(n-1) + f(n-2));
}
Fetching token