Last active
February 18, 2018 12:13
-
-
Save sguzunov/d0104b97150f59f80ad870b31d66e72d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Text; | |
using System.Threading.Tasks; | |
// https://judge.softuni.bg/Contests/Practice/Index/179#4 | |
namespace DrawButterfly | |
{ | |
public class Program | |
{ | |
public static void Main() | |
{ | |
int n = int.Parse(Console.ReadLine()); | |
int sideWidth = n - 1; | |
int halfPartHeight = n - 2; | |
// Drawing first part | |
for (int rowIndex = 0; rowIndex < halfPartHeight; rowIndex++) | |
{ | |
char symbol = '*'; | |
if (rowIndex % 2 != 0) | |
{ | |
symbol = '-'; | |
} | |
// Left side | |
string rowOutput = ""; | |
for (int i = 0; i < sideWidth - 1; i++) | |
{ | |
rowOutput += symbol; | |
} | |
rowOutput += "\\ /"; | |
// Right side | |
for (int i = 0; i < sideWidth - 1; i++) | |
{ | |
rowOutput += symbol; | |
} | |
// Draw row string | |
Console.WriteLine(rowOutput); | |
} | |
// Draw middle row | |
string middleRow = "@"; | |
for (int i = 0; i < sideWidth; i++) | |
{ | |
middleRow = " " + middleRow; | |
} | |
for (int i = 0; i < sideWidth; i++) | |
{ | |
middleRow = middleRow + " "; | |
} | |
// Draw middle row | |
Console.WriteLine(middleRow); | |
// Drawing second part | |
for (int rowIndex = 0; rowIndex < halfPartHeight; rowIndex++) | |
{ | |
char symbol = '*'; | |
if (rowIndex % 2 != 0) | |
{ | |
symbol = '-'; | |
} | |
// Left side | |
string rowOutput = ""; | |
for (int i = 0; i < sideWidth - 1; i++) | |
{ | |
rowOutput += symbol; | |
} | |
rowOutput += "/ \\"; | |
// Right side | |
for (int i = 0; i < sideWidth - 1; i++) | |
{ | |
rowOutput += symbol; | |
} | |
// Draw row string | |
Console.WriteLine(rowOutput); | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment