Advertisement
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 PerfectDiamond
- {
- class PerfectDiamond
- {
- static void Main(string[] args)
- {
- int n = int.Parse(Console.ReadLine());
- var spaces2 = n - 2 ;
- //UPPER
- Console.WriteLine("{0}*", new string (' ', n -1));
- for (int row = 1; row <= n - 1; row++)
- {
- Console.Write("{0}*", new string (' ', spaces2));
- for (int col = 0; col < row; col++)
- {
- Console.Write("-*");
- }
- spaces2--;
- Console.WriteLine();
- }
- //LOWER
- spaces2 = 1;
- for (int row = 1; row <= n - 2; row++)
- {
- Console.Write("{0}*", new string(' ', spaces2));
- for (int col = n-2; col >= row; col--)
- {
- Console.Write("-*");
- }
- spaces2++;
- Console.WriteLine();
- }
- Console.WriteLine("{0}*", new string(' ', n - 1));
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement