Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- namespace FomichevaApp
- {
- class Program
- {
- static void Main(string[] args)
- {
- var h = int.Parse(Console.ReadLine());
- h += 2;
- if (h % 2 == 0)
- {
- throw new NotImplementedException("Number should be odd");
- }
- for (var i = 0; i < h; i++)
- {
- if (i == 0 || i == h-1)
- {
- Console.WriteLine("{0}", new string('+', h));
- }
- else
- {
- int spacesBefore = Math.Abs(h / 2 - i);//Количество пробелов в начале строке
- int starsCount = (h - 2 * spacesBefore);//Количество звёздочек
- Console.WriteLine("{0}{1}{2}", new string('+', spacesBefore+1), new string('o', starsCount-2), new string('+', spacesBefore+1));
- }
- }
- Console.Read();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement