tanasaradu

Untitled

Oct 28th, 2017
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.30 KB | None | 0 0
  1. #include <iostream>
  2. #include <fstream>
  3. #include<bitset>
  4. using namespace std;
  5. int main ()
  6. {
  7. int x,y,z;
  8. long long n;
  9. cin>>n;
  10. z=0;
  11. x=y=1;
  12. cout<<x<<" "<<y<<" ";
  13. while(z<=n)
  14. {
  15. z=x+y;
  16. if(z<=n)
  17. cout<<z<<" ";
  18. x=y;
  19. y=z;
  20. }
  21. }
Advertisement
Add Comment
Please, Sign In to add comment