Advertisement
Niicksana

Snowflake

Dec 13th, 2017
151
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 2.30 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.Snowflake
  8. {
  9.     class Snowflake
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             // Exam - 03 September 2017
  14.             int n = int.Parse(Console.ReadLine());
  15.  
  16.             int firstDots = 0;
  17.             int centralDots = n;
  18.  
  19.             for (int first = 1; first <= n - 1; first++)
  20.             {
  21.                 Console.Write(new string('.', firstDots));
  22.                 Console.Write("*");
  23.                 Console.Write(new string('.', centralDots));
  24.                 Console.Write("*");
  25.                 Console.Write(new string('.', centralDots));
  26.                 Console.Write("*");
  27.                 Console.WriteLine(new string('.', firstDots));
  28.                 firstDots++;
  29.                 centralDots--;
  30.             }
  31.  
  32.             Console.Write(new string('.', firstDots));
  33.             Console.Write("*");
  34.             Console.Write(new string('*', centralDots));
  35.             Console.Write("*");
  36.             Console.Write(new string('*', centralDots));
  37.             Console.Write("*");
  38.             Console.WriteLine(new string('.', firstDots));
  39.  
  40.             Console.WriteLine(new string('*',2 * n + 3));
  41.  
  42.             for (int second = 1; second <= n - 1; second++)
  43.             {
  44.                 if (second == 1)
  45.                 {
  46.                     Console.Write(new string('.', firstDots));
  47.                     Console.Write("*");
  48.                     Console.Write(new string('*', centralDots));
  49.                     Console.Write("*");
  50.                     Console.Write(new string('*', centralDots));
  51.                     Console.Write("*");
  52.                     Console.WriteLine(new string('.', firstDots));
  53.                     firstDots--;
  54.                     centralDots++;
  55.                 }
  56.  
  57.                 Console.Write(new string('.', firstDots));
  58.                 Console.Write("*");
  59.                 Console.Write(new string('.', centralDots));
  60.                 Console.Write("*");
  61.                 Console.Write(new string('.', centralDots));
  62.                 Console.Write("*");
  63.                 Console.WriteLine(new string('.', firstDots));
  64.                 firstDots--;
  65.                 centralDots++;
  66.             }
  67.         }
  68.     }
  69. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement