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