Advertisement
Niicksana

Profit

Dec 13th, 2017
151
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 2.40 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.             //int startDots = n;
  33.             //int cenDots = (2 * n + 3) - ((2 * n - 2) - 3) / 2;
  34.             Console.Write(new string('.', firstDots));
  35.             Console.Write("*");
  36.             Console.Write(new string('*', centralDots));
  37.             Console.Write("*");
  38.             Console.Write(new string('*', centralDots));
  39.             Console.Write("*");
  40.             Console.WriteLine(new string('.', firstDots));
  41.  
  42.             Console.WriteLine(new string('*',2 * n + 3));
  43.  
  44.             for (int second = 1; second <= n - 1; second++)
  45.             {
  46.                 if (second == 1)
  47.                 {
  48.                     Console.Write(new string('.', firstDots));
  49.                     Console.Write("*");
  50.                     Console.Write(new string('*', centralDots));
  51.                     Console.Write("*");
  52.                     Console.Write(new string('*', centralDots));
  53.                     Console.Write("*");
  54.                     Console.WriteLine(new string('.', firstDots));
  55.                     firstDots--;
  56.                     centralDots++;
  57.                 }
  58.  
  59.                 Console.Write(new string('.', firstDots));
  60.                 Console.Write("*");
  61.                 Console.Write(new string('.', centralDots));
  62.                 Console.Write("*");
  63.                 Console.Write(new string('.', centralDots));
  64.                 Console.Write("*");
  65.                 Console.WriteLine(new string('.', firstDots));
  66.                 firstDots--;
  67.                 centralDots++;
  68.             }
  69.         }
  70.     }
  71. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement