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