Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace Diamond
- {
- class Program
- {
- static void Main(string[] args)
- {
- int size = int.Parse(Console.ReadLine());
- int slash = 0;
- int halfSize = (size - 1) / 2;
- int star = 0;
- if (size % 2 == 0)
- {
- star = 2;
- slash = 2;
- }
- else
- {
- star = 1;
- slash = 1;
- }
- Console.WriteLine("{0}{1}{0}", new string('-', (size - 1) / 2), new string('*', star));
- for (int i = 0; i < halfSize; i++)
- {
- Console.WriteLine("{0}*{1}*{0}", new string('-', (size - 2 - slash) / 2), new string('-', slash ));
- slash += 2;
- }
- slash = size - 4;
- for (int i = halfSize - 1; i > 0; i--)
- {
- Console.WriteLine("{0}*{1}*{0}", new string('-', (size - 2 - slash) / 2), new string('-', slash));
- slash -= 2;
- }
- if (size > 2)
- {
- Console.WriteLine("{0}{1}{0}", new string('-', (size - 1) / 2), new string('*', star));
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment