class Program
{
static void Main(string[] args)
{
Console.WriteLine("Enter the row number");
int n = int.Parse(Console.ReadLine());
for (int row = 1; row <= n * 2 - 1; row++)
{
for (int coll = 1; coll <= n * 2 - 1; coll++)
{
if (row == 1 || row == n * 2 - 1 || coll == 1 ||
coll == n * 2 - 1 || coll == 2 * n / 2 - row + 1 || row + n - 1 == coll
|| coll + n - 1 == row || coll + 2 * n - 1 == row + n || row + 1 - n == 2 * n - coll)
{
Console.Write("*" + " ");
}
else
{
Console.Write(" ");
}
}
Console.WriteLine();
}
Console.ReadLine();
}
}
No comments:
Post a Comment