# Help me in solving AOCV202 problem

### My issue

i did not undserstand logic

### My code

``````// Solution as follows

#include <bits/stdc++.h>
using namespace std;

int main()
{
int t;
cin >> t;

while(t--)
{
int N;
cin>>N;
int A[N];

for(int i = 1; i <= N; i++)
{
A[i-1] = i;
}
// print the elements of array A
for(int i = 0; i < N; i++)
{
cout << A[i] << " ";
}
cout << endl;
// print the elements of array A in descending order
for(int i = N-1; i >= 0; i--)
{
cout << A[i] << " ";
}
cout << endl;
}
}

``````

Learning course: Beginner DSA in C++
Problem Link: CodeChef: Practical coding for everyone

@prafulkeshri47
Its a simple implementation problem u have to take input of array in ascending order as 1 2 3 and so on.
and first print the array as it is and then print the array in reverse order .

You have to modify the while loop as follows

``````#include <bits/stdc++.h>
using namespace std;

int main()
{
int t;
cin >> t;

while(t-->0)
{
int N;
cin>>N;
int A[N];

for(int i = 1; i <= N; i++)
{
A[i-1] = i;
}
// print the elements of array A
for(int i = 0; i < N; i++)
{
cout << A[i] << " ";
}
cout << endl;
// print the elements of array A in descending order
for(int i = N-1; i >= 0; i--)
{
cout << A[i] << " ";
}
cout << endl;
}
}
``````