#include
using namespace std;
int main(){
int M,N;
cin>>M>>N;
int arr[M][N];
for (int i = 0; i < M; i++)
{
for (int j = 0; j < N; j++)
{
cin>>arr[i][j];
}
}
cout<<endl;
for (int i = 0; i < M; i++)
{
if (i%2==0)
{
for (int j = 0; i < N; j++)
{
cout<<arr[i][j]<<" ";
}
}
else
{
for (int j = N-1; j >=0 ; j--)
{
cout<<arr[i][j]<<" ";
}
}
}
return 0;
}
my code is shoeing correct output but after completing it’s task it is giving garbage value
please tell what’s wrong