Advertisement
dimipan80

Exam 2. Eclipse

Jun 7th, 2014
221
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.46 KB | None | 0 0
  1. namespace _3.Eclipse
  2. {
  3.     using System;
  4.  
  5.     public class Eclipse
  6.     {
  7.         public static void Main(string[] args)
  8.         {
  9.             checked
  10.             {
  11.                 int height = int.Parse(Console.ReadLine());
  12.  
  13.                 int widthLenses = (2 * height) - 2;
  14.                 int widthBridge = height - 1;
  15.                 string lensesStr = new string('/', widthLenses);
  16.                 lensesStr = '*' + lensesStr + '*';
  17.                 for (int row = 0; row < height; row++)
  18.                 {
  19.                     string spacesBetweenFrames;
  20.                     if (row == 0 || row == height - 1)
  21.                     {
  22.                         string asterisksSeq = new string('*', widthLenses);
  23.                         spacesBetweenFrames = new string(' ', height + 1);
  24.                         Console.WriteLine(" {0}{1}{0}", asterisksSeq, spacesBetweenFrames);
  25.                     }
  26.                     else if (row == height / 2)
  27.                     {                        
  28.                         string bridgeStr = new string('-', widthBridge);
  29.                         Console.WriteLine("{0}{1}{0}", lensesStr, bridgeStr);
  30.                     }
  31.                     else
  32.                     {
  33.                         spacesBetweenFrames = new string(' ', widthBridge);
  34.                         Console.WriteLine("{0}{1}{0}", lensesStr, spacesBetweenFrames);
  35.                     }
  36.                 }
  37.             }
  38.         }
  39.     }
  40. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement