one of my test cases isn’t working right
#include
#include
using namespace std;
int main() {
int n;
cin>>n;
int arr[1001];
for(int i=0;i<n;i++)
cin>>arr[i];
int target;
cin>>target;
sort(arr,arr+n);
int left=arr[0];
int right=arr[n-1];
int sum=0;
while(left<right){
sum= left+right;
if(sum>target){
cout<<left<<" and "<<right;
cout<<endl;
}
if(sum<target){
left++;
}
else
right–;
}
return 0;
}