Advertisement
Josif_tepe

Untitled

Nov 24th, 2023
519
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.37 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.     while(T <= n) {
  18.         T = F + S;
  19.         if(T <= n) {
  20.             cout << T << " ";
  21.         }
  22.         F = S;
  23.         S = T;
  24.        
  25.        
  26.     }
  27.  
  28.     return 0;
  29. }
  30.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement