Arrays-Target Sum Pairs

In 4# test case time limit error is shown ,plz debugg my prog,

@akb.tech17 Do it with a single while loop.

Something like this:

while(l<r){

    cs= a[l]+a[r];

    if(cs>target){
        r--;
    }
    else if(cs==target){
         cout<<a[l]<<" and "<<a[r]<<endl;
         l++;
         r--;
    }
    else  l++;

}