#include<stdio.h>
int fibonacci(int p);
main() {
int n, i;
printf("Enter No. of elements in the series\n");
scanf("%d", & n);
printf("Fibonanacci Series is :\n");
for (i = 0; i < n; i++) {
printf("%d - %d\n", i + 1, fibonacci(i));
}
}
int fibonacci(int p) {
if (p < 2) {
return 1;
} else {
return (fibonacci(p - 1) + fibonacci(p - 2));
}
}
Note: Need to be arranged in compiler after copied
OutPut:
Enter No. of elements in the series
15
Fibonanacci Series is :
1 - 1
2 - 1
3 - 2
4 - 3
5 - 5
6 - 8
7 - 13
8 - 21
9 - 34
10 - 55
11 - 89
12 - 144
13 - 233
14 - 377
15 - 610