Still getting all the test cases wrong sir first you try this code .cpy from here and run on your system

import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner sc=new Scanner(System.in);
int n=sc.nextInt();
int m=sc.nextInt();
int [][]arr=new int[n][m];
for(int i=0;i<arr.length;i++) {
for(int j=0;j<arr[i].length;j++) {
arr[i][j]=sc.nextInt();
}
}
printrowwise(arr);
sc.close();
}
public static void printrowwise(int [][]arr) {
for(int i=0;i<arr.length;i++) {
if(i%2==0) {
for(int j=0;j<arr[i].length;j++) {
System.out.print(arr[i][j]+",");
}
}
else {
for(int j=arr[i].length-1;j>=0;j–) {
System.out.print(arr[i][j]+",");
}
}
}
System.out.println("END ");
}
}

Hello Subham
Please try to implement this corrected code and let me know if you still face any issue

import java.util.*;
public class Main {
public static void main(String args[]) {
int k;
int n;
int m;
int a[][];
int l;
Scanner s=new Scanner(System.in);
m=s.nextInt();
n=s.nextInt();
a=new int[m][n];
for(k=0;k<m;k++){
for(l=0;l<n;l++){
a[k][l]=s.nextInt();
}
}
int row=a.length;
int col=a[0].length;
for(int i=0;i<col;i++){
if(i%2==0){
for(int j=0;j<row;j++){
System.out.print(a[j][i]+", β€œ);
}
}
else
{
for(int j=row-1;j>=0;j–){
System.out.print(a[j][i]+”, β€œ);
}
}
}
System.out.print(β€œEND”+” ");

}

}