Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int a[20];
- int main()
- {
- int n, i;
- cin >> n;
- for(i = 1; i <= n; i++) a[i] = 0;
- while(a[0] == 0)
- {
- for(i = 1; i <= n; i++) if(a[i] == 1) cout << i << " ";
- cout << "\n";
- for(i = n; a[i] == 1; i--) a[i] = 0;
- a[i] = 1;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment