Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace Sunglases
- {
- class Sunglases
- {
- static void Main()
- {
- int n = int.Parse(Console.ReadLine());
- for (int i = 0; i < n; i++)
- {
- if ( i == 0 || i == n - 1)
- {
- PrintTopBottomPar(n);
- }
- else
- {
- PrintMiddlePart(n , i);
- }
- }
- }
- private static void PrintMiddlePart(int n , int i)
- {
- string lens = new string('/', n * 2 - 2);
- string middleframe = string.Format("{0}{1}{0}", '*', lens);
- string connection = new string(' ', n);
- if ( i == n / 2)
- {
- connection = new string('|', n);
- }
- Console.WriteLine("{0}{1}{0}", middleframe, connection);
- }
- private static void PrintTopBottomPar(int n)
- {
- string frame = new string('*', 2 * n);
- string emptyspace = new string(' ', n);
- Console.WriteLine("{0}{1}{0}" , frame , emptyspace , frame);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment