I ran the program and it outputs the same as the example in the task condition.
However, it doesn't pass the verification. More precisely it is wrong for number 3. and 4.
Am I missing something else?
Looking forward to your help!
package en.codegym.task.jdk13.task06.task0634;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.sql.SQLOutput;
import java.util.Scanner;
/*
Chess board
*/
public class Solution {
public static char[][] array;
public static void main(String[] args) throws IOException {
BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(System.in));
int dim = Integer.parseInt(bufferedReader.readLine());
array = new char[dim][dim];
int c = 0;
for(int z = 0; z < dim; z++) {
for(int s = 0; s < dim; s++) {
if((c%2) == 0)
array[z][s] = '#';
else
array[z][s] = ' ';
c++;
}
}
for(int z = 0; z < dim; z++) {
for(int s = 0; s < dim; s++) {
System.out.print(array[z][s]);
}
System.out.println();
}
}
}