Matrix search(((((((((()))))))))))

hello my two test cases are failing …please tell my mistake
#include
using namespace std;
void staircase(int a[][100] , int n , int m){
int i=0,j=m-1;
int x;
cin>>x;
bool isnopresent = false;

while(i=0){
if(a[i][j]==x){
isnopresent = true;
cout<<“1”;
break;
}
else if(a[i][j] < x){
i++;
}
else if(a[i][j] > x){
j–;
}

}

if(isnopresent == false){
cout<<“0”;
}
}

int main() {
int n,m;
cin>>n>>m;
int a[100][100];
staircase(a , n , m);

return 0;

}

hi @abhinavssr2003_eab0717682969e5c,

  1. missing input
  2. i<n not i<j
    commented and updated code https://ide.codingblocks.com/s/660517

ohh yeah…i just did silly mistakes without even taking the input

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.