Not able to figure out error

output is fine

#include
using namespace std;

int main()
{
int N,Target;
cin>>N;
int Array[N];

for (int i = 0; i < N; i++)
{
    cin>>Array[i];
}

cin>>Target;

for (int i = 0; i < N/2; i++)
{
    for (int j = 0; j < N; j++)
    {
        if (Array[i]+Array[j]==Target)
        {
            cout<<Array[i]<<" and "<<Array[j];
            
        }
        
    }
    cout<<endl;
}


return 0; 

}

#include using namespace std; int main() { int N,Target; cin>>N; int Array[N]; for (int i = 0; i < N; i++) { cin>>Array[i]; } cin>>Target; for (int i = 0; i < N/2; i++) { for (int j = 0; j < N; j++) { if (Array[i]+Array[j]==Target) { cout<<Array[i]<<" and "<<Array[j]; } } cout<<endl; } return 0; }

#include
using namespace std;

int main()
{
int N,Target;
cin>>N;
int Array[N];

for (int i = 0; i < N; i++)
{
    cin>>Array[i];
}

cin>>Target;

for (int i = 0; i < N/2; i++)
{
    for (int j = 0; j < N; j++)
    {
        if (Array[i]+Array[j]==Target)
        {
            cout<<Array[i]<<" and "<<Array[j];
            
        }
        
    }
    cout<<endl;
}


return 0; 

}

not able to figure out error…

hello @rprahulpal03 please wait i am checkingyour code.

hello @rprahulpal03 i have corrected your code and commented the mistake and not it is printing the correct result.


Happy Learning !!

thanks sir…

hello @rprahulpal03 if you feel that your doubt is cleared you can mark this doubt as resolved.
Happy Learning !!

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.