Doubt in rotate iMAGE

import java.util.*;
public class Main {

    static Scanner scn = new Scanner(System.in);

public static void main(String[] args) {
	int row = scn.nextInt();
	int col = scn.nextInt();
	int[][] arr = new int[row][col];
	for (int i = 0; i < row; i++) {

		for (int j = 0; j < col; j++) {
			arr[i][j] = scn.nextInt();
		}

	}
	ROTATEIMAGE(arr);

}
public static void ROTATEIMAGE(int [][] arr) {
	int left,right,top,bottom,count;
	left=0;
	top=0;
	right=arr[top].length-1;
	bottom=arr.length-1;
	count=(bottom+1)*(right+1);
	while (left<=right && top<=bottom) {
		if (count>0) {
			for(int i=right;i>=0;i--) {
				for(int j=top;j<=bottom;j++) {
					System.out.println(arr[j][right]+" ");
					count--;
				}
				right--;
			}
		}
	}
	
	
	
	
	
	
}

}
what is wrong in this code???

Hey @harsh.hj
Input Format
First line contains a single integer N. Next N lines contain N space separated integers.
Why are you Taking Extra input Col ?? :thinking:
correct code :

sorry i was confused thanks for resolving my doubt

@harsh.hj
Please mark your doubts as resolved in your course’s. and rate full