Viacheslav

Untitled

Sep 22nd, 2017
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 2.57 KB | None | 0 0
  1. using System;
  2.  
  3. namespace Exam05Cup
  4. {
  5.     class MainClass
  6.     {
  7.         public static void Main(string[] args)
  8.         {
  9.             int cupSize = int.Parse(Console.ReadLine());
  10.             //upperPartOfTheCup
  11.             int upperPartCountOfRows = cupSize / 2;
  12.             int upperPartCountOfDots = cupSize;
  13.             int upperPartCountOfHex = cupSize * 3;
  14.  
  15.             for (int i = 0; i < upperPartCountOfRows; i++)
  16.             {
  17.                 Console.WriteLine("{0}{1}{0}",
  18.                                   new string ('.', upperPartCountOfDots),
  19.                                   new string ('#', upperPartCountOfHex));
  20.                 upperPartCountOfDots += 1;
  21.                 upperPartCountOfHex -= 2;
  22.             }
  23.             //secondPart
  24.             int secondPartCountOfRows = cupSize / 2 + 1;
  25.             int secondPartMiddleDots = cupSize * 2 - 2;
  26.             int secondPartSideDots = upperPartCountOfDots;
  27.  
  28.             for (int i = 0; i < secondPartCountOfRows; i++)
  29.             {
  30.                 Console.WriteLine("{0}#{1}#{0}",
  31.                                   new string ('.', secondPartSideDots),
  32.                                   new string ('.', secondPartMiddleDots));
  33.                 secondPartSideDots += 1;
  34.                 secondPartMiddleDots -= 2;
  35.             }
  36.             // thirdPart
  37.             int thirdPartMiddleHashes = secondPartMiddleDots + 4;
  38.             Console.WriteLine("{0}{1}{0}",
  39.                               new string ('.', secondPartSideDots - 1),
  40.                               new string ('#', thirdPartMiddleHashes));
  41.             //fourthPart
  42.             int fourthPartCountOfRows = cupSize / 2;
  43.  
  44.             for (int i = 0; i < fourthPartCountOfRows; i++)
  45.             {
  46.                 Console.WriteLine("{0}{1}{0}",
  47.                                   new string ('.', secondPartSideDots - 3),
  48.                                   new string ('#', thirdPartMiddleHashes + 4));
  49.             }
  50.             //textpartumber of dots
  51.             int textpartNumberOfDots = (cupSize * 5 - 10) / 2;
  52.             Console.WriteLine("{0}D^A^N^C^E^{0}",
  53.                               new string ('.', textpartNumberOfDots));
  54.             //lowerPart of cup
  55.             int lowerParCountOfRows = cupSize / 2 + 1;
  56.  
  57.             for (int i = 0; i < lowerParCountOfRows; i++)
  58.             {
  59.                 Console.WriteLine("{0}{1}{0}",
  60.                                   new string ('.', secondPartSideDots - 3),
  61.                                   new string ('#', thirdPartMiddleHashes + 4));
  62.             }
  63.         }
  64.     }
  65. }
Add Comment
Please, Sign In to add comment