Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace _10_Diamond
- {
- class Program
- {
- static void Main(string[] args)
- {
- int size = int.Parse(Console.ReadLine());
- int stars = size % 2 == 0 ? 2 : 1;
- int topspace = (size - stars) / 2;
- string topstars = new string('*', stars);
- string topspaces = new string('-', topspace);
- Console.WriteLine("{0}{1}{0}", topspaces, topstars, topspaces);
- int secondrowdash = stars;
- int secondrowsides = (size - 2 - secondrowdash) / 2;
- int rows = (size - 1) / 2;
- for (int a = 0; a < rows; a++)
- {
- string secondrowdmidashes = new string('-', secondrowdash);
- string secondrowsidedash = new string('-', secondrowsides);
- Console.WriteLine("{0}*{1}*{0}", secondrowsidedash, secondrowdmidashes);
- secondrowsides--;
- secondrowdash+=2;
- }
- secondrowsides+=2;
- secondrowdash -= 4;
- for (int b = 0; b < rows - 1; b++)
- {
- string secondrowdmidashes = new string('-', secondrowdash);
- string secondrowsidedash = new string('-', secondrowsides);
- Console.WriteLine("{0}*{1}*{0}", secondrowsidedash, secondrowdmidashes);
- secondrowsides++;
- secondrowdash -= 2;
- }
- if (size > 2) { Console.WriteLine("{0}{1}{0}", topspaces, topstars, topspaces); }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement