Advertisement
Guest User

Untitled

a guest
Dec 14th, 2017
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.51 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int Fibb(int k);
  6. void WypTab(int k, int tab[], int i);
  7.  
  8. int main()
  9. {
  10. int tablica[10];
  11. for(int i=0;i<10;i++)
  12. cout<<Fibb(i)<<" ";
  13. cout<<endl;
  14. WypTab(10, tablica, 5);
  15. return 0;
  16. }
  17.  
  18. int Fibb(int k)
  19. {
  20.  
  21. if(k==0)
  22. return 0;
  23. else if(k==1)
  24. return 1;
  25. else
  26. return Fibb(k-1)+Fibb(k-2);
  27. }
  28.  
  29. void WypTab(int k, int tab[], int i)
  30. {
  31. for(int j=0;j<10+i-1;j++)
  32. {
  33. if(j>=i-1)
  34. {
  35. tab[j-i]=Fibb(j);
  36. cout<<tab[j-i]<<" ";
  37. }
  38. }
  39. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement