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?
Loops
Chessboard printer
Report a typo
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)
___
By continuing, you agree to the JetBrains Academy Terms of Service as well as Hyperskill Terms of Service and Privacy Policy.
Create a free account to access the full topic
By continuing, you agree to the JetBrains Academy Terms of Service as well as Hyperskill Terms of Service and Privacy Policy.