Advertisement
Niicksana

Christmas Toy

Jan 2nd, 2018
141
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 3.18 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace _5.Christmas_Toy
  8. {
  9.     class Program
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             // Programming Basics Exam - 16 December 2017
  14.             int n = int.Parse(Console.ReadLine());
  15.  
  16.             int firstDashes = 2 * n;
  17.             int firstStars = n;
  18.             int and = n + 2;
  19.             int stars = 1;
  20.  
  21.             Console.Write(new string('-', firstDashes));
  22.             Console.Write(new string('*', firstStars));
  23.             Console.WriteLine(new string('-', firstDashes));
  24.             firstDashes -= 2;
  25.  
  26.             for (int row = 1; row <= n / 2; row++)
  27.             {
  28.                 Console.Write(new string('-', firstDashes));
  29.                 Console.Write(new string('*', stars));
  30.                 Console.Write(new string('&', and));
  31.                 Console.Write(new string('*', stars));
  32.                 Console.WriteLine(new string('-', firstDashes));
  33.                 firstDashes -= 2;
  34.                 stars++;
  35.                 and += 2;
  36.             }
  37.  
  38.             firstDashes++;
  39.             int symbol = 5 * n - (2 * firstDashes + 4);
  40.             for (int row = 1; row <= n / 2; row++)
  41.             {
  42.                 Console.Write(new string('-', firstDashes));
  43.                 Console.Write("*");
  44.                 Console.Write("*");
  45.                 Console.Write(new string('~', symbol));
  46.                 Console.Write("*");
  47.                 Console.Write("*");
  48.                 Console.WriteLine(new string('-', firstDashes));
  49.                 firstDashes--;
  50.                 symbol += 2;
  51.             }
  52.  
  53.             firstDashes++;
  54.             symbol -= 2;
  55.             int newSymbol = 5 * n - (2 * firstDashes + 2);
  56.  
  57.             Console.Write(new string('-', firstDashes));
  58.             Console.Write("*");
  59.             Console.Write(new string('|', newSymbol));
  60.             Console.Write("*");
  61.             Console.WriteLine(new string('-', firstDashes));
  62.  
  63.             for (int row = 1; row <= n / 2; row++)
  64.             {
  65.                 Console.Write(new string('-', firstDashes));
  66.                 Console.Write("*");
  67.                 Console.Write("*");
  68.                 Console.Write(new string('~', symbol));
  69.                 Console.Write("*");
  70.                 Console.Write("*");
  71.                 Console.WriteLine(new string('-', firstDashes));
  72.                 firstDashes++;
  73.                 symbol -= 2;
  74.             }
  75.  
  76.             stars--;
  77.             and -= 2;
  78.             for (int row = 1; row <= n / 2; row++)
  79.             {
  80.                 Console.Write(new string('-', firstDashes));
  81.                 Console.Write(new string('*', stars));
  82.                 Console.Write(new string('&', and));
  83.                 Console.Write(new string('*', stars));
  84.                 Console.WriteLine(new string('-', firstDashes));
  85.                 firstDashes += 2;
  86.                 stars--;
  87.                 and -= 2;
  88.             }
  89.  
  90.             Console.Write(new string('-', firstDashes));
  91.             Console.Write(new string('*', firstStars));
  92.             Console.WriteLine(new string('-', firstDashes));
  93.         }
  94.     }
  95. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement