What is the error

#include
using namespace std;
int main() {
int i,n,j,a,b,arr[10];
cin>>n;
for(i=0;i<n+1;i++)
{
cin>>arr[i];
}
for(i=0;i<n-1;i++)
{
for(j=i+1;j<n+1;j++)
{
if(arr[i]+arr[j]==n)
{
cout<<arr[i]<<“and”<<arr[j]<<endl;
}
}
}

return 0;

}

Hi,

You are taking n+1 elements in input.You should take n elements in input.
Also, i and j should be less than n.

there are n+1 elements so thats the reason for taking n+1 as inputs

Take i less than n and j less than n+1.

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.