package en.codegym.task.jdk13.task06.task0634;
import java.util.Scanner;
/*
Chess board
*/
public class Solution {
public static char[][] array;
public static void main(String[] args) {
//write your code here
Scanner scanner = new Scanner(System.in);
//System.out.println("please Enter a number :");
int input = scanner.nextInt();
//System.out.println(input);
array = new char[input][input];
int len = array.length;
boolean val1 = true;
for (int i = 0; i < len; i++) {
for (int j = 0; j < len; j++) {
// here the logic
if (val1) {
if (((i + 1) % 2 != 0) && ((j + 1) % 2 != 0)) {
array[i][j] = '#';
}
} else {
if (((i + 1) % 2 == 0) && ((j + 1) % 2 == 0)) {
array[i][j] = '#';
}
}
}
val1 = !val1;
}
for (int i = 0; i < len; i++) {
for (int j = 0; j < len; j++) {
System.out.print(array[i][j]);
}
System.out.println();
}
}
}
package en.codegym.task.jdk13.task06.task0634;
import java.util.Scanner;
/*
Chess board
*/
public class Solution {
public static char[][] array;
public static void main(String[] args) {
//write your code here
Scanner scanner = new Scanner(System.in);
//System.out.println("please Enter a number :");
int input = scanner.nextInt();
//System.out.println(input);
array = new char[input][input];
int len = array.length;
boolean val1 = true;
for (int i = 0; i < len; i++) {
for (int j = 0; j < len; j++) {
// here the logic
if (val1) {
if (((i + 1) % 2 != 0) && ((j + 1) % 2 != 0)) {
array[i][j] = '#';
}
} else {
if (((i + 1) % 2 == 0) && ((j + 1) % 2 == 0)) {
array[i][j] = '#';
}
}
}
val1 = !val1;
}
for (int i = 0; i < len; i++) {
for (int j = 0; j < len; j++) {
System.out.print(array[i][j]);
}
System.out.println();
}
}
}