This is my recursive code that will print numbers according to fibbonacci series..
My problem is I want the program to stack (store the numbers) numbers before the printing (in order starting with 3-21) but it should still be a recursive program.
Can you help me, which part I should edit?
I want it to stack before it prints. What this code do is it prints the number immediately..
#include <stdio.h>
void fibbo ();
main (){
int cnt=5, n1=1, n2=2;
clrscr ();
fibbo (cnt,n1,n2);
return 0;
getch ();
}
void fibbo (int cnt, int n1, int n2) {
if (cnt==1) {
printf ("%d", n1+n2);
}
else {
printf ("%d", n1+n2);
fibbo (cnt-1, n2, n1+n2);
}
}