Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- class HeadPhone
- {
- static void Main()
- {
- int n = int.Parse(Console.ReadLine());
- char line = '-';
- char star = '*';
- // first row
- int firstLine = n/2;
- int firstStars = n+2;
- Console.WriteLine("{0}{1}{0}",
- new string (line,firstLine),
- new string (star,firstStars));
- // end first
- // second row
- for (int i = 0; i < n; i++)
- {
- Console.WriteLine("{0}*{1}*{0}",
- new string (line,firstLine),
- new string (line,n));
- }
- // end second
- // third row
- int thirdDots = firstLine - 1;
- int thirdStars = 3;
- int thirdInnerDots = n - 2;
- for (int i = 0; i < n/2-1; i++)
- {
- Console.WriteLine("{0}{1}{2}{1}{0}",
- new string(line, thirdDots),
- new string(star, thirdStars),
- new string(line, thirdInnerDots));
- thirdDots--;
- thirdStars += 2;
- thirdInnerDots -= 2;
- }
- // end third
- // four row
- Console.WriteLine("{0}-{0}",new string (star,n));
- // end four
- // five row
- for (int i = 0; i < n / 2 - 1; i++)
- {
- thirdDots++;
- thirdStars -= 2;
- thirdInnerDots += 2;
- Console.WriteLine("{0}{1}{2}{1}{0}",
- new string(line, thirdDots),
- new string(star, thirdStars),
- new string(line, thirdInnerDots));
- }
- // end five
- // last row
- Console.WriteLine("{0}*{1}*{0}",
- new string (line,firstLine),
- new string (line,n));
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement