This code is working on sample input and i checked it it works fine but it is not able to pass even a single test case can you please tell me where is my mistake

#include
using namespace std;
int main() {
int row;
cin>>row;
int col;
cin>>col;

int n;
int rem;
int x=0;
int arr[100][100];
for(int i=0;i<row;i++){
	for(int j=0;j<col;j++){
		cin>>arr[i][j];
	}
}
while( x<row){
	if((x+1)%2!=0){
		for(int j=0;j<col;j++){
			int a=arr[x][j];
			int reverse=0;
			while(a!=0)    
          {    
         rem=a%10;      
         reverse=reverse*10+rem;    
          a=a/10;    
          }
		  arr[x][j]=reverse; 
		  cout<<arr[x][j]<<","<<" ";   
		}

	}
	else{
		for(int j=col-1;j>=0;j--){
			int a=arr[x][j];
			int reverse=0;
			while(a!=0)    
      {    
         rem=a%10;      
         reverse=reverse*10+rem;    
          a=a/10;    
          }
		   arr[x][j]=reverse;
		   cout<<arr[x][j]<<","<<" ";   
		}

	}
	x++;
}
cout<<"END";

return 0;

}

HI @utkarahpandey
refer my code --> https://ide.codingblocks.com/s/640810

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.