Advertisement
dimipan80

Task4_TelerikLogo

Apr 7th, 2014
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 2.07 KB | None | 0 0
  1. using System;
  2. using System.Globalization;
  3. using System.Threading;
  4.  
  5. class TelerikLogo
  6. {
  7.     static void Main()
  8.     {
  9.         Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;
  10.         checked
  11.         {
  12.             byte numX = byte.Parse(Console.ReadLine());
  13.            
  14.             int numZ = numX / 2 + 1;
  15.             int elemOnLine = (2 * numX) + (2 * ((numX / 2) + 1)) - 3;
  16.             int countLines = elemOnLine;
  17.             int halfLine = elemOnLine / 2 + 1;
  18.             int midLine = numX;
  19.             int elemBetweens = elemOnLine - (2 * ((numX / 2) + 1));
  20.             int midOfDownPart = midLine + (elemBetweens / 2) + 1;
  21.             for (int row = 1; row < midLine; row++)
  22.             {
  23.                 for (int col = 1; col <= elemOnLine; col++)
  24.                 {
  25.                     if (col == numX / 2 + row || col == halfLine + numX - row
  26.                         || col == elemBetweens + numZ + row || col == numZ - row + 1)                        
  27.                     {
  28.                         Console.Write("*");
  29.                     }
  30.                     else
  31.                     {
  32.                         Console.Write(".");
  33.                     }                    
  34.                 }
  35.                 Console.WriteLine();
  36.             }
  37.  
  38.             for (int row = midLine; row <= countLines; row++)
  39.             {
  40.                 for (int col = 1; col <= elemOnLine; col++)
  41.                 {
  42.                     if (row <= midOfDownPart && (col == numZ + (2 * numX) - row - 1 || col == (numX / 2) + row))
  43.                     {
  44.                         Console.Write("*");
  45.                     }
  46.                     else if (row > midOfDownPart && (col == row - numX - (numX / 2) + 1
  47.                         || col == countLines - row + halfLine))
  48.                     {
  49.                         Console.Write("*");
  50.                     }
  51.                     else
  52.                     {
  53.                         Console.Write(".");
  54.                     }
  55.                 }
  56.                 Console.WriteLine();
  57.             }
  58.         }
  59.     }
  60. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement