Advertisement
IvanBorisovG

Snowflake

Sep 6th, 2017
141
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.27 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 Snowflake
  8. {
  9.     class Program
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             int size = int.Parse(Console.ReadLine());
  14.  
  15.             int height = 2 * size + 1;
  16.             int width = 2 * size + 3;
  17.             char Dots = '.';
  18.             char asterisks = '*';
  19.             for (int row = 0; row <= height / 2 - 2; row++)
  20.             {
  21.                 Console.WriteLine("{0}*{1}*{1}*{0}", new string(Dots, row), new string(Dots,size));
  22.                 size--;                
  23.             }
  24.             for (int row = 0; row <= height / 2 - 2; row++)
  25.             {
  26.                 size++;
  27.             }
  28.             Console.WriteLine("{0}{1}{0}", new string(Dots, size - 1), new string(asterisks, 5));
  29.             Console.WriteLine(new string(asterisks,width));
  30.             Console.WriteLine("{0}{1}{0}", new string(Dots, size - 1), new string(asterisks, 5));
  31.  
  32.             for (int row = 0; row <= height / 2 - 2; row++)
  33.             {
  34.                 Console.WriteLine("{0}*{1}*{1}*{0}", new string(Dots, size - 2), new string(Dots, row + 2));
  35.                 size--;
  36.             }          
  37.         }      
  38.     }
  39. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement