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()
- {
- int n = int.Parse(Console.ReadLine());
- int left = n / 2;
- int right = left;
- if(n % 2 == 0)
- {
- left--;
- }
- while(left >= 0)
- {
- for (int col = 0; col < n; col++)
- {
- if(col == left || col == right)
- {
- Console.Write("*");
- }
- else
- {
- Console.Write("-");
- }
- }
- left--;
- right++;
- Console.WriteLine();
- }
- left = 1;
- right = n - 2;
- while(left <= right)
- {
- for (int col = 0; col < n; col++)
- {
- if(col == left || col == right)
- {
- Console.Write("*");
- }
- else
- {
- Console.Write("-");
- }
- }
- left++;
- right--;
- Console.WriteLine();
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment