Advertisement
Josif_tepe

Untitled

Nov 24th, 2023
570
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.39 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5.  
  6. int main()
  7. {
  8.     int n;
  9.     cin >> n;
  10.    
  11.    
  12.     int F = 1, S = 1;
  13.     cout << F << " " << S << " ";
  14.    
  15.     int T = F + S;
  16.    
  17.     for(int i = F + S; i <= n;) {
  18.         i = F + S;
  19.        
  20.         if(i <= n) {
  21.             cout << i << " ";
  22.         }
  23.        
  24.         F = S;
  25.         S = i;
  26.        
  27.     }
  28.  
  29.     return 0;
  30. }
  31.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement