Chessboard printer

Report a typo

We hope you like chess! To play the game, you need an 8x8 board with checkered light and dark squares. Here, we started a program that prints a chessboard with the '#' symbol as dark squares and spaces as light squares. Can you finish the program?

Sample Input 1:

Sample Output 1:

 # # # #
# # # # 
 # # # #
# # # # 
 # # # #
# # # # 
 # # # #
# # # # 
Write a program in Scala 3
@main def chessboard =
for
row <- 0 to 7
column <- ???
symbol = if ??? % 2 == 0 then '#' else ' '
do
if ??? then println(symbol)
else print(symbol)
___

Create a free account to access the full topic