Next_permutation problem

I have written the code , there is no compilation error, but it is showing the wrong output.

The code is:
#include
#include
using namespace std;
int main() {
int t;
cin>>t;

int N;
cin>>N;
while(t--)
{
int arr[] = {1,2,3,4,5,6,7,8,9};
int n = sizeof(arr)/sizeof(int);

for(int i=0;i<N;i++)
{
	cin>>arr[i];
}
next_permutation(arr,arr+N);
for(int x:arr)
{
	cout<<x<<" ";
}
}
return 0;

}

@ankita_10
hello ankita,
a) read n inside ur while loop
b) declare ur array after reading n as int arr[n] and then read array

image

It’s done ,thank you

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.