Guest User

Untitled

a guest
Apr 10th, 2015
316
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.61 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace ConsoleApplication4
  8. {
  9.     class Program
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             const int SIZE = 8;
  14.  
  15.             //go through rows
  16.             for (int i = 0; i < SIZE; i++)
  17.             {
  18.                 //go through columns
  19.                 for (int j = 0; j < SIZE; j++)
  20.                 {
  21.                     //alternate X's and O's
  22.                     if (i % 2 == j % 2) Console.Write("X");
  23.                     else Console.Write("O");
  24.                 }
  25.  
  26.                 //end the row
  27.                 Console.WriteLine();
  28.             }
  29.  
  30.             //wait for user response to kill program
  31.             Console.ReadKey();
  32.         }
  33.     }
  34. }
Advertisement
Add Comment
Please, Sign In to add comment