Triple sum subarray

#include
#include
#include
using namespace std;

// int find(int arr[10],int len,int sum);

int find(int arr[1000], int len, int key){
sort(arr, arr+len);
int i = 0 ;
int j = len -2 ;
int k = len -1 ;

while( i < j && (arr[i]+arr[j]+arr[k])==key){
    while((arr[i] + arr[j] + arr[k]) <= key && i < j && j < k ){
        if((arr[i] + arr[j] + arr[k]) == key)
            cout <<arr[i] << ", " << arr[j] << " and " << arr[k] << endl;
        i++;
    }
    j--;
    k--;
    while((arr[i] + arr[j] + arr[k]) >= key && i < j && j < k){
        if((arr[i] + arr[j] + arr[k]) == key)
            cout << arr[i] << ", " << arr[j] << " and "<< arr[k] << endl;
        j--;
        k--;
    }
}

}

int main(){
int n;
cin>>n;
int arr [10000];
for(int i=0;i<n;i++){
cin>>arr[i];
}
int key;
cin>>key;
find(arr, n, key);
}

can anyone tell me the problem

while( i < j && (arr[i]+arr[j]+arr[k])==key)

This condition is the problem according to me. When the code runs for the first time, this condition is false and code exits the function directly without doing anything.

https://ide.codingblocks.com/s/34641

This is my code, if you are not able to solve this one.
Please Do try once again before submitting this code.
And comment below if you have any doubts.

you have send the wrong code

sorry, i forgot saving the code.

https://ide.codingblocks.com/s/34716

This is the correct link. Sorry for the inconvenience.

in else if statement u have j++ ;
and in else u have done k-- ;

if target >temp
we can also write k-- for every value of i and j
and in else
we can write j++ for every i and k
but when i do this
#1 test casw show me wrong ans
#2 test is correct

or can u dry run else if and else statement