* * * * * *
* *
* * * *
* *
* * * * * * * * *
* *
* * * *
* *
* * * * * *
* *
* * * *
* *
* * * * * * * * *
* *
* * * *
* *
* * * * * *
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 == n || coll == n || coll == 1 && row <= n - 1 || coll == 2 * n - 1 && row > n - 1
|| row == 1 && coll >= n || row == 2 * n - 1 && coll <= n ||
coll == n - (n / 2) && row == n - (n / 2) || coll == n + (n / 2) && row == n + (n / 2)
|| coll == n - (n / 2) && row == n + (n / 2) || coll == n + (n / 2) && row == n - (n / 2))
{
Console.Write("*" + " ");
}
else
{
Console.Write(" ");
}
}
Console.WriteLine();
}
Console.ReadLine();
}
}
No comments:
Post a Comment