Skip to content

Instantly share code, notes, and snippets.

@ktopchiev ktopchiev/Snowflake.cs
Last active Nov 29, 2017

Embed
What would you like to do?
Рисуване на снежинка със C#
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Snowflake
{
class Program
{
static void Main(string[] args)
{
int n = int.Parse(Console.ReadLine());
var dots = 1;
var dots2 = 1;
//Рисуване на горната част
Console.WriteLine("*" + new string('.', n) + "*" + new string('.', n) + "*");
for (int up = 0; up < n; up++)
{
dots2 = n - dots;
Console.WriteLine(new string('.', dots) + "*" + new string('.', dots2) + "*" + new string('.', dots2) + "*" + new string('.', dots));
dots++;
if (dots == n - 1)
{
Console.WriteLine(new string('.', n - 1) + "*****" + new string ('.', n - 1));
break;
}
}
//Рисуване на средната част
Console.WriteLine(new string('*', 2 * n + 3));
//Рисуване на долната част
Console.WriteLine(new string('.', n - 1) + "*****" + new string('.', n - 1));
for (int down = 0; down < n - 1; down++)
{
dots2 = n - dots + 1;
Console.WriteLine(new string('.', dots - 1) + "*" + new string('.', dots2) + "*" + new string('.', dots2) + "*" + new string('.', dots - 1));
dots--;
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.