Error in the code

can you please check my code im not getting the ouput
#include
using namespace std;
int main(){

int m, n;
cin>>m>>n;

int arr[n][n];

for(int i=0;i<n;i++){
	for(int j=0;j<n;j++){
		cin>>arr[i][j];
	}
}




int key;
cin>>key;

int i=0;
int j=n-1;

while(i<n && j>=0){
	if(arr[i][j] == key){
	 	cout<<" element found at the index"<<i<<" "<<j<<" ";
	}
	 if(arr[i][j]>key){
		j--;
	}
	else {
		i++;
	}

	
	
}

}

Hey @mohammednomaan45
ig ur code is working fine


I have just added one statement for if the element is not found

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.