fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int fibo(int x)
  5. {
  6. if (x == 0) return 0;
  7. if (x == 1) return 1;
  8.  
  9. return fibo(x-1)+fibo(x-2);
  10. }
  11.  
  12. int main()
  13. {
  14. int j=1,limit=100;
  15.  
  16. do
  17. {
  18. cout<< fibo(j) <<'\t';
  19. ++j;
  20. } while(fibo(j)<=limit);
  21.  
  22. return 0;
  23. }
Success #stdin #stdout 0s 3340KB
stdin
Standard input is empty
stdout
1	1	2	3	5	8	13	21	34	55	89