Anonymous Anonymous - 2 months ago
322 0

No description

C#

12345

static void Main(string[] args)
        {
            string[,] array = new string[10, 20];

            for (int i = 0; i < array.GetLength(0); i++)
            {
                for (int y = 0; y < array.GetLength(1); y++)
                {
                    int targetRemainder = i % 2 == 0 ? 1 : 0;
                    if(y % 2 == targetRemainder)
                    {
                        array[i, y] = "x";
                    }
                    else
                    {
                        array[i, y] = "o";
                    }
                }
            }

            for (int i = 0; i < array.GetLength(0); i++)
            {
                for (int y = 0; y < array.GetLength(1); y++)
                {
                    Console.Write(array[i,y]);
                }
                Console.WriteLine();
            }

            Console.ReadKey();
        }