Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- class Program
- {
- static void Main()
- {
- int x = int.Parse(Console.ReadLine());
- int z = x / 2 + 1;
- int length = 3*x - 2;
- int height = length;
- z = z - 1; //coz of zero
- for (int j = 0; j < length; j++) //rows
- {
- for (int i = 0; i < length; i++) //cols
- {
- if (i == z - j)
- {
- Console.Write("*");
- }
- else if((i == z + j)&&(j < 2*x-1))
- {
- Console.Write("*");
- }
- else if((i==length - z - j -1)&&(j< 2*x-1))
- {
- Console.Write("*");
- }
- else if(i == length - z + j -1)
- {
- Console.Write("*");
- }
- else if ((i == z+j+1 -(x*2-1)) && (j >= 2 * x - 1)) //last
- {
- Console.Write("*");
- }
- else if ((i == length - z -j-2 +(x*2-1)) && (j >= 2 * x - 1)) //last right
- {
- Console.Write("*");
- }
- else
- {
- Console.Write(".");
- }
- }
- Console.WriteLine();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement