Advertisement
Josif_tepe

Untitled

Apr 20th, 2022
797
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.31 KB | None
  1. #include <iostream>
  2. #include <cstring>
  3.  
  4. using namespace std;
  5.  
  6.  
  7. int main()
  8. {
  9.     int n = 3;
  10.     for(int i = 0; i < (1 << n); i++) {
  11.         for(int j = 0; j < n; j++) {
  12.             if(i & (1 << j)) {
  13.                 cout << j + 1 << " ";
  14.             }
  15.         }
  16.         cout << endl;
  17.     }
  18.   return 0;
  19. }
  20.  
Advertisement
RAW Paste Data Copied
Advertisement