lina_os

Untitled

Nov 2nd, 2024
33
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.33 KB | None | 0 0
  1. #include <iostream>
  2. #include <cmath>
  3.  
  4. using namespace std;
  5.  
  6. int main(){
  7.  
  8. int n;
  9. cin >> n;
  10. int k=0;
  11. int l=1;
  12. for(int i=1; i<n; i++){
  13. if(i==1)cout <<k << " ";
  14. if(i==2)cout <<l << " ";
  15. else{
  16. cout << k+l << " ";
  17. l=k+l; k=l-k;
  18. }
  19. }
  20.  
  21.  
  22. return 0;
  23. }
Advertisement
Add Comment
Please, Sign In to add comment