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 Diamond
- {
- static void Main(string[] args)
- {
- int size = int.Parse(Console.ReadLine());
- //printing the top part
- int sideDots = size;
- int middleSymbol = (3 * size) - 2;
- for (int currRow = 0; currRow < size; currRow++)
- {
- char symbolToUse = currRow == 0 ? '*' : '.';
- Console.Write(new string('.', sideDots - currRow));
- Console.Write('*');
- Console.Write(new string(symbolToUse, middleSymbol));
- Console.Write('*');
- Console.WriteLine(new string('.', sideDots - currRow));
- middleSymbol += 2;
- }
- //printing the mid row
- Console.WriteLine(new string('*', size * 5));
- //printing the bot row
- int botRows = ((size * 3) + 2) - (size + 1);
- for (int currRow = 1; currRow <= botRows; currRow++)
- {
- char symbolToUse = currRow == botRows ? '*' : '.';
- middleSymbol -= 2;
- Console.Write(new string('.', currRow));
- Console.Write('*');
- Console.Write(new string(symbolToUse, middleSymbol));
- Console.Write('*');
- Console.WriteLine(new string('.', currRow));
- }
- }
- }
- }
Add Comment
Please, Sign In to add comment