hi , this is the output of the program ;Code:`#include <iostream>`

#include <algorithm>

using namespace std;

int main () {

int n=4;

int myints[] = {1,2,3,4};

do {

for(int i=0 ; i<n ;i++)

cout << myints[i];

cout<<endl;

} while ( next_permutation (myints,myints+2) );

return 0;

}

1 2 3 4

2 1 3 4

now the question is how can i make the output like this ;

1 2 3 4

1 2 4 3

2 1 3 4

2 1 4 3

if you realize first 2 number had made a permutation each other and the other last 2 number had a permutation each other ,

the example is about 4 number making and per 2 of them making permutation ( 2!*2!= 4 possible results )

from here if you give me the idea i will try to make this code for ' n '

like we say there are 9 number and per 3 of them makes permutation,(3! *3!*3! = 108 possible results)