Write a program in C to print fibonacci series upto given number using recursive function.
#include <stdio.h> #include <conio.h> int fibo(int x); int main() { int i,n,a; clrscr(); printf("Enter a no:-"); scanf("%d",&n); for(i=1;i<=n;i++) printf("%d\t",fibo(i)); return 0; } int fibo(int x) { if(x==1) return 0; if(x==2) return 1; else return(fibo(x-1)+fibo(x-2)); getch(); }
0 Comments