Respected sir
the following code is working perfectly in dev c++. Hoever its showing some error here. Could you please help me with it.
#include
using namespace std;
int main() {
int N,M,x=0;
int a[N][M];
cin>>N>>M;
for(int i=0;i<N;i++)
{
for(int j=0;j<M;j++)
{
cin>>a[i][j];
}
}
cin>>x;
int j=M-1;
int i=0;
while(i<N && j>=0)
{
if(a[i][j]==x)
{
x=1;
break;
}
else if(a[i][j]>x)
{
j--;
}
else
i++;
}
if(x==1)
{
cout<<1;
}
else cout<<0;
return 0;
}
Thanks
Manah Verma