Regeneric

Untitled

Nov 12th, 2020
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.46 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. void fib(unsigned int);
  4.  
  5. auto main(int argc, char** argv) -> int {
  6. unsigned int x;
  7. while(std::cin >> x) fib(x);
  8.  
  9. return 0;
  10. }
  11.  
  12.  
  13. auto fib(unsigned int x) -> void {
  14. long i = 0, j = 1;
  15. for(int k = 0; k < 50; k++) {
  16. if(k == 0) std::cout << i*x << std::endl;
  17. if(k == 1) std::cout << j*x << std::endl;
  18.  
  19. j += i;
  20. i = j - i;
  21. std::cout << j*x << std::endl;
  22. }
  23.  
  24. return;
  25. }
Add Comment
Please, Sign In to add comment