Advertisement
Fricer

Sunglasses

Jun 1st, 2014
277
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.15 KB | None | 0 0
  1. using System;
  2.  
  3. class Sunglasses
  4. {
  5.     public static void Main()
  6.     {
  7.         int height = int.Parse(Console.ReadLine());
  8.         int width = 2 * height;
  9.         string upperPart = new string('*', width);
  10.         string bridge = new string('|', height);
  11.         string bridgeSpace = new string(' ', height);
  12.         int middleOfTheHeight = (height / 2) + 1;
  13.  
  14.         if (height % 2 != 0)
  15.         {
  16.             Console.WriteLine(upperPart + bridgeSpace + upperPart);
  17.             for (int line = 0 ; line < height-2; line++)
  18.             {
  19.                 if (line != (height-2)/2)
  20.                 {
  21.                     string lens = new string('/', width - 2);
  22.                     Console.WriteLine("*" + lens + "*" + bridgeSpace + "*" + lens + "*");
  23.                 }
  24.                 else if (line == (height-2)/2)
  25.                 {
  26.                     string lens = new string('/', width - 2);
  27.                     Console.WriteLine("*" + lens + "*" + bridge + "*" + lens + "*");
  28.                 }
  29.             }
  30.  
  31.             string lowerPart = upperPart;
  32.             Console.WriteLine(lowerPart + bridgeSpace + lowerPart);
  33.         }
  34.     }
  35. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement