Array-target sum pairs ( 4th testcase is not running)

#include
using namespace std ;
int main()
{
int n ;
cin >>n ; //no of elements to be inserted
float a[n];
for(int i=0 ;i<n;i++)
{
cin >>a[i] ; //elements to be inserted
}
float target ;
cin >> target ; //target variable
for(int i=0 ;i<n;i++)
{
float s=0 ;
for(int j=i ;j<n;j++)
{
s=a[i]+a[j] ; // sum is calculated at each step
if(s==target)
{
if(!(a[i]<0&&a[j]<0)) // if both elements are less than 0 than do not enter this loop
{ // first print minimum of a[i] and a[j] and than max of them
// for input 10 ,20 …output is “10 and 20”
// for input -10,20 …output is “-10 and 20”
cout<<min(a[i],a[j])<<" and “<<max(a[i],a[j]) ;
}
else{
if(abs(a[i]) > abs(a[j])) //for input -20 ,-10
cout << a[j]<<” and “<<a[i] ; // output is " -10 and -20 "
else //for input -10 ,-20
cout << a[i]<<” and "<<a[j] ; //output is -10 and -20
}
cout<<endl ;
}
}
}
}

hi lokesh can you please explain the reason for using float data type and please save your code on the online ide

I have tried the code by doing int …but still giving same output …float is not making any problem.

please add comments in your logic so that i can understand your logic.

@AASTHA011 i have added comments

hi lokesh your code is not producing any output for the test case
5
1
3
4
2
5
5
i would suggest you to try a different approach as this approach is taking too long to respond so as a result complexity will be high