Advertisement
Guest User

Untitled

a guest
May 11th, 2014
295
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.69 KB | None | 0 0
  1. using System;
  2. class Sunglasses
  3. {
  4.     static void Main()
  5.     {
  6.         int N = int.Parse(Console.ReadLine());
  7.         char[,] sunglasses = new char[N, (N * 4) + N];
  8.         int start = 0;
  9.         int end = N * 2;
  10.         int currentIndex = 0;
  11.         for (int row = 0; row < N; row++)
  12.         {
  13.             for (int col = start; col < end; col++)
  14.             {
  15.                 if (row == 0 || row == N - 1)
  16.                 {
  17.                     sunglasses[row, col] = '*';
  18.                 }
  19.                 else if (col == start || col == end - 1)
  20.                 {
  21.                     sunglasses[row, col] = '*';
  22.                 }
  23.                 else
  24.                 {
  25.                     sunglasses[row, col] = '/';
  26.                 }
  27.  
  28.             }
  29.         }
  30.  
  31.         for (int i = end; i < end + N; i++)
  32.         {
  33.             sunglasses[N / 2, i] = '|';
  34.         }
  35.  
  36.         start = end + N;
  37.         end = start + N * 2;
  38.  
  39.         for (int row = 0; row < N; row++)
  40.         {
  41.             for (int col = start; col < end; col++)
  42.             {
  43.                 if (row == 0 || row == N - 1)
  44.                 {
  45.                     sunglasses[row, col] = '*';
  46.                 }
  47.                 else if (col == start || col == end - 1)
  48.                 {
  49.                     sunglasses[row, col] = '*';
  50.                 }
  51.                 else
  52.                 {
  53.                     sunglasses[row, col] = '/';
  54.                 }
  55.  
  56.             }
  57.         }
  58.  
  59.         for (int i = 0; i < N; i++)
  60.         {
  61.             for (int k = 0; k < (N * 4) + N; k++)
  62.             {
  63.                 Console.Write(sunglasses[i,k]);
  64.             }
  65.             Console.WriteLine();
  66.         }
  67.     }
  68. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement