-
Notifications
You must be signed in to change notification settings - Fork 2
/
17.* Sunglasses
44 lines (42 loc) · 1.11 KB
/
17.* Sunglasses
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
using System;
class Sunglasses
{
static void Main()
{
int n=int.Parse(Console.ReadLine());
string asterisk=new string('*',2*n);
string emptySpace = new string(' ', n);
PrintFrames(asterisk, emptySpace);
Console.WriteLine();
string slashLens = new string('/',2*n-2);
string verticalBar = new string('|',n);
for (int i = 1; i < n-1; i++)
{
PrintLens(slashLens);
if ((n-1)/2==i)
{
Console.Write(verticalBar);
}
else
{
Console.Write(emptySpace);
}
PrintLens(slashLens);
Console.WriteLine();
}
PrintFrames(asterisk, emptySpace);
Console.WriteLine();
}
private static void PrintFrames(string asterisk, string emptySpace)
{
Console.Write(asterisk);
Console.Write(emptySpace);
Console.Write(asterisk);
}
private static void PrintLens(string slashLens)
{
Console.Write('*');
Console.Write(slashLens);
Console.Write('*');
}
}