Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- class Star
- {
- static void Main()
- {
- int n = int.Parse(Console.ReadLine());
- char dot = '.';
- // first row
- Console.WriteLine("{0}*{0}",new string (dot,n));
- // end first
- // second row
- int secondDots = n - 1;
- int secondInnerDots = 1;
- for (int i = 0; i < n/2-1; i++)
- {
- Console.WriteLine("{0}*{1}*{0}",
- new string(dot, secondDots),
- new string (dot,secondInnerDots));
- secondDots--;
- secondInnerDots += 2;
- }
- // end second
- // third row
- Console.WriteLine("{0}{1}{0}", new string('*', n / 2 + 1), new string(dot, n - 1));
- // end third
- // four row
- int fourDots = 1;
- int fourInnerDots = (n*2+1)-4;
- for (int i = 0; i < n/2-1; i++)
- {
- Console.WriteLine("{0}*{1}*{0}",
- new string (dot,fourDots),
- new string (dot,fourInnerDots));
- fourDots++;
- fourInnerDots -= 2;
- }
- // end four
- // five
- Console.WriteLine("{0}*{1}*{1}*{0}",new string (dot,n/2),new string(dot,n/2-1) );
- // end five
- // six row
- int sixDots = n / 2 - 1;
- int sixDotsUnchange = n/2-1;
- int sixInnerDots = 1;
- for (int i = 0; i < n/2-1; i++)
- {
- Console.WriteLine("{0}*{1}*{2}*{1}*{0}",
- new string(dot, sixDots),
- new string(dot, sixDotsUnchange),
- new string(dot, sixInnerDots));
- sixDots--;
- sixInnerDots += 2;
- }
- // end six
- // last
- Console.WriteLine("{0}{1}{0}", new string('*', n / 2 + 1), new string(dot, n - 1));
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement