static void Main(string[] args)
{
Console.Write("Enter number : ");
int a = int.Parse(Console.ReadLine());
Console.WriteLine();
if (a >= 2 || a <= 10)
{
for (int i = a; i >= 1; i--)
{
for (int j = 1; j <= i; j++)
{
Console.Write(j);
}
Console.WriteLine();
for (int b = a; b >= i; b--)
{
Console.Write(" ");
}
}
}
Console.WriteLine();
Console.WriteLine("==================================================================");
Console.WriteLine();
if (a >= 2 || a <= 10)
{
for (int i = 1; i <= a; i++)
{
for (int j = a; j >= i; j--)
{
Console.Write(i);
}
Console.WriteLine();
}
}
Console.WriteLine();
Console.WriteLine("==================================================================");
Console.WriteLine();
if (a >= 2 || a <= 10)
{
for (int i = 1; i <= a; i++)
{
for (int j = 1; j <= a; j++)
{
if (i == 1 || i == a || j == 1 || j == a)
{
Console.Write(i);
}
else
{
Console.Write(" ");
}
}
Console.WriteLine();
}
}
Console.ReadLine();
}
ส่วนตัว
{
Console.Write("Enter number : ");
int a = int.Parse(Console.ReadLine());
Console.WriteLine();
if (a >= 2 || a <= 10)
{
for (int i = a; i >= 1; i--)
{
for (int j = 1; j <= i; j++)
{
Console.Write(j);
}
Console.WriteLine();
for (int b = a; b >= i; b--)
{
Console.Write(" ");
}
}
}
Console.WriteLine();
Console.WriteLine("==================================================================");
Console.WriteLine();
if (a >= 2 || a <= 10)
{
for (int i = 1; i <= a; i++)
{
for (int j = a; j >= i; j--)
{
Console.Write(i);
}
Console.WriteLine();
}
}
Console.WriteLine();
Console.WriteLine("==================================================================");
Console.WriteLine();
if (a >= 2 || a <= 10)
{
for (int i = 1; i <= a; i++)
{
for (int j = 1; j <= a; j++)
{
if (i == 1 || i == a || j == 1 || j == a)
{
Console.Write(i);
}
else
{
Console.Write(" ");
}
}
Console.WriteLine();
}
}
Console.ReadLine();
}