Create the pattern of a chess board that is 8 x 8. Use X and O to represent the squares.
Create the appropriate nested looping structure to output the characters in an 8 x 8 grid on the screen using Console.Write() or Console.WriteLine() as appropriate.
Include a decision structure to ensure that alternate rows start with opposite characters as a real chess board alternates the colors among rows.
This is what your output should look like.
Used a nested loop
Used a decision structure to flip row output
Output is correct per above image
1
Expert's answer
2016-09-30T14:28:04-0400
using System; using System.Collections.Generic; using System.Text; namespace Question_62350 { class Program { static void Main(string[] args) { for (int i = 0; i < 8; i++) { for (int j=0; j < 8; j++) if ((i + j) % 2 == 0) // a decision structure // for switching first row character Console.Write("X"); else Console.Write("O"); Console.WriteLine(); } Console.ReadKey(); } } }
Numbers and figures are an essential part of our world, necessary for almost everything we do every day. As important…
APPROVED BY CLIENTS
"assignmentexpert.com" is professional group of people in Math subjects! They did assignments in very high level of mathematical modelling in the best quality. Thanks a lot
Comments
Leave a comment