Advertisement
archangelmihail

UKFlag

Dec 3rd, 2013
51
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 2.58 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 UKFlag
  8. {
  9.     class UKFlag
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             int size = int.Parse(Console.ReadLine());
  14.             int[,] matrix = new int[size, size];
  15.             matrix[size / 2, size / 2] = 5;
  16.             for (int row = 0; row < size; row++)
  17.             {
  18.                 for (int col = 0; col < size; col++)
  19.                 {
  20.                     if (row == size/2 && col != size/2)
  21.                     {
  22.                         matrix[row, col] = 4;
  23.                     }
  24.                     else if (row != size/2 && col == size /2)
  25.                     {
  26.                         matrix[row, col] = 1;
  27.                     }
  28.                 }
  29.             }
  30.            
  31.             int startSlash = 0;
  32.             int endSlash = size / 2;
  33.             for (int row = 0; row < size / 2; row++)
  34.             {
  35.                 for (int col = 0; col < size / 2; col++)
  36.                 {
  37.                     if (startSlash <= col && col <= endSlash)
  38.                     {
  39.                             matrix[row, col] = 3;
  40.                             matrix[row, size - 1 - col] = 2;
  41.                             matrix[size - 1 - row, col] = 2;
  42.                             matrix[size - 1 - row, size - 1 - col] = 3;
  43.                             row++;
  44.                     }
  45.                 }
  46.                 startSlash++;
  47.             }
  48.            
  49.             for (int row = 0; row < size; row++)
  50.             {
  51.                 for (int col = 0; col < size; col++)
  52.                 {
  53.                     if (matrix[row, col] == 0)
  54.                     {
  55.                         Console.Write('.');
  56.                     }
  57.                     else if (matrix[row, col] == 1)
  58.                     {
  59.                         Console.Write('|');
  60.                     }
  61.                     else if (matrix[row, col] == 4)
  62.                     {
  63.                         Console.Write('-');
  64.                     }
  65.                     else if (matrix[row, col] == 5)
  66.                     {
  67.                         Console.Write('*');
  68.                     }
  69.                     else if (matrix[row, col] == 2)
  70.                     {
  71.                         Console.Write('/');
  72.                     }
  73.                     if (matrix[row, col] == 3)
  74.                     {
  75.                         Console.Write('\\');
  76.                     }
  77.                 }
  78.                 Console.WriteLine();
  79.             }
  80.         }
  81.     }
  82. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement