Advertisement
g-stoyanov

Eggcelent

Apr 11th, 2014
158
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.26 KB | None | 0 0
  1. namespace Task04Eggcelent
  2. {
  3.     using System;
  4.  
  5.     class Program
  6.     {
  7.         static void Main()
  8.         {
  9.             string[] models = new string[] { "@.", ".@" };
  10.             int eggSize = int.Parse(Console.ReadLine());
  11.             string topAndBottom = string.Format("{0}{1}{0}",
  12.                 new string('.', eggSize + 1),
  13.                 new string('*', eggSize - 1));
  14.             Console.WriteLine(topAndBottom);
  15.             for (int i = eggSize - 1; i >= -(eggSize - 1); i -= 2)
  16.             {
  17.                 if (i == -1)
  18.                 {
  19.                     for (int pattern = 0; pattern < 2; pattern++)
  20.                     {
  21.                         Console.Write(".*");
  22.                         for (int row = 0; row < (eggSize * 3 - 3) / 2; row++)
  23.                         {
  24.                             Console.Write("{0}", models[pattern]);
  25.                         }
  26.  
  27.                         Console.WriteLine("{0}*.", models[pattern][0]);
  28.                     }
  29.                 }
  30.  
  31.                 Console.WriteLine("{0}*{1}*{0}",
  32.                     new string('.', Math.Abs(i)),
  33.                     new string('.',((eggSize * 3 + 1) - (Math.Abs(i) * 2 + 2))));
  34.             }
  35.             Console.WriteLine(topAndBottom);
  36.         }
  37.     }
  38. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement