bacco

Снежинка :Snowflake

Feb 13th, 2018
138
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 3.24 KB | None | 0 0
  1. using System;
  2.  
  3. namespace Снежинка
  4. {
  5.     class Program
  6.     {
  7.         static void Main(string[] args)
  8.         {
  9.            
  10.  
  11.             var n = int.Parse(Console.ReadLine());
  12.  
  13.             int hight = 2 * n + 1;
  14.             int widht = 2 * n + 3;
  15.  
  16.             int dotTopCount = n;
  17.             string dotTop = new string('.', dotTopCount);
  18.             Console.WriteLine($"*{dotTop}*{dotTop}*");
  19.                                     //     UP
  20.  
  21.             for (int row = 1; row < n - 1; row++)
  22.             {
  23.                 for (int col = n  - row; col < n ; col++)
  24.                 {
  25.                     Console.Write(".");
  26.                 }
  27.                 Console.Write("*");
  28.  
  29.  
  30.                 for (int colTwo = 1+row; colTwo <= n; colTwo++)
  31.                 {
  32.                     Console.Write(".");
  33.                 }
  34.  
  35.                 Console.Write("*");
  36.  
  37.                 for (int colTwo = 1 + row; colTwo <= n; colTwo++)
  38.                 {
  39.                     Console.Write(".");
  40.                 }
  41.  
  42.                 Console.Write("*");
  43.  
  44.                 for (int col = n - row; col < n; col++)
  45.                 {
  46.                     Console.Write(".");
  47.                 }
  48.  
  49.                 Console.WriteLine();
  50.             }
  51.  
  52.             //     MIDLE
  53.  
  54.             int starsMidTwoCount = 5;
  55.             string starsMidTwo = new string('*', starsMidTwoCount);
  56.  
  57.             int dotsMidTwoCount = (widht - starsMidTwoCount) / 2;
  58.             string dotsMidTwo = new string('.', dotsMidTwoCount);
  59.  
  60.             Console.WriteLine($"{dotsMidTwo}{starsMidTwo}{dotsMidTwo}");
  61.  
  62.  
  63.             int starsMidCount = widht ;
  64.             string starsMid = new string('*', starsMidCount);
  65.             Console.WriteLine($"{starsMid}");
  66.  
  67.  
  68.             Console.WriteLine($"{dotsMidTwo}{starsMidTwo}{dotsMidTwo}");
  69.  
  70.                                     //     MIDLE
  71.  
  72.             for (int row = n - 1; row > 1; row--)
  73.             {
  74.                 for (int col = n - row + 1; col < n; col++)
  75.                 {
  76.                     Console.Write(".");
  77.                 }
  78.                 Console.Write("*");
  79.  
  80.  
  81.                 for (int colTwo = 1 + row - 1; colTwo <= n; colTwo++)
  82.                 {
  83.                     Console.Write(".");
  84.                 }
  85.  
  86.                 Console.Write("*");
  87.  
  88.                 for (int colTwo = 1 + row - 1; colTwo <= n; colTwo++)
  89.                 {
  90.                     Console.Write(".");
  91.                 }
  92.  
  93.                 Console.Write("*");
  94.  
  95.                 for (int col = n - row + 1; col < n; col++)
  96.                 {
  97.                     Console.Write(".");
  98.                 }
  99.  
  100.                 Console.WriteLine();
  101.             }
  102.  
  103.                                     //     DOWN
  104.          
  105.  
  106.             Console.WriteLine($"*{dotTop}*{dotTop}*");
  107.         }
  108.     }
  109. }
  110.  
  111. //     3    *...*...*
  112. //          .*..*..*.
  113. //          ..*****..
  114. //          *********
  115. //          ..*****..
  116. //          .*..*..*.
  117. //          *...*...*
  118.  
  119. //     5  *.....*.....*
  120. //        .*....*....*.
  121. //        ..*...*...*..
  122. //        ...*..*..*...
  123. //        ....*****....
  124. //        *************
  125. //        ....*****....
  126. //        ...*..*..*...
  127. //        ..*...*...*..
  128. //        .*....*....*.
  129. //        *.....*.....*
Advertisement
Add Comment
Please, Sign In to add comment