Please Find the Problem in this code

#include
#include
#include"bits/stdc++.h"

using namespace std;

int main()
{

int n;
int target;
cin>>n>>target;
int a[1000];
for(int i=0;i<1000;i++)
{
	cin>>a[i];
}

sort(a,a+n);
int strt=0;
int end=n-1;

while(strt<end)
{
	int sum = a[strt] + a[end];
	if(sum > target){
		end--;
	}
	else if(sum<target){
		strt++;
	}
	else if(sum==target)
	{
		cout<<strt<<" and "<<end<<endl;
		strt++;
		end--;
	}
}

return 0;

}

It is compiling successfully but not giving any ouput

Hey @Ekansh_14

#include<bits/stdc++.h>
using namespace std;
int main() {
	int n;
int target;
cin>>n; //not here
int a[1000];
for(int i=0;i<n;i++) //i<n here
{
	cin>>a[i];
}
cin>>target;//here
sort(a,a+n);
int strt=0;
int end=n-1;

while(strt<end)
{
	int sum = a[strt] + a[end];
	if(sum > target){
		end--;
	}
	else if(sum<target){
		strt++;
	}
	else if(sum==target)
	{
		cout<<a[strt]<<" and "<<a[end]<<endl; //updated this as well
		strt++;
		end--;
	}
}

return 0;
	return 0;
}

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.