Advertisement
LEGEND2004

For

Feb 10th, 2024
1,083
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.52 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3.  
  4. int main()
  5. {
  6.     int n;
  7.     cin >> n;
  8.     for(int i = 1; i <= n; i++){ // 1 2 ... n
  9.       cout << i << " ";
  10.     }
  11.     cout << '\n';
  12.     for(int i = n; i >= 1; i--){ // n n-1 ... 1
  13.       cout << i << " ";
  14.     }
  15.     cout << '\n';
  16.     for(int i = 1; i <= n; i *= 2){ // 1 2 4 ...
  17.       cout << i << " ";
  18.     }
  19.     cout << '\n';
  20.     int a , b;
  21.     cin >> a >> b;
  22.     for(int i = a; i <= b; i++){ // a a+1 .. b-1 b
  23.       cout << i << " ";
  24.     }
  25.     cout << '\n';
  26. }
  27.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement