/* EXPERIMENT - */ /* AIM : TO GENERATE THE FIRST 'N' TERMS OF THE FIBONACI SERIES USING RECURSIVE FUNCTION */ /* PROGRAMMER : SHEKHAR A. SHERIKAR */ /* COMPUTER TECHNOLOGY - CM102 (B3) */ main() { int x,a=3,b=1,c=2,o=0,v=0; clrscr(); printf("\n\t\tEnter the upper limit for the series : "); scanf("%d",&x); if((x>1)&&(x<3)) printf("\t1\t1\t"); if(x==1) printf("\t1\t"); if((x>2)&&(x<24)) { printf("\t1\t1\t2\t"); a=fibo(a,b,c,o,v,x); } else { clrscr(); printf("\n\n\n\n\n\n\n\n\t\t\t\tINPUT ERROR !"); printf("\n\n\n\t\t Press any key to return to source file....."); getch(); exit(); } printf("\n\t\tAND THE BET IS WON !!!!!!!!!"); getch(); } fibo(int u,int i,int f,int t,int p,int x) { p=i+f; printf("%d\t",p); i=f; f=p; u=u+1; t++; if(u>x-1) return(t); else fibo(u,i,f,t,p,x); }