如何用罪简略的循环语句来构成这个图案?
求大佬么赐教~~~
我是新手小白,我想了半天
我只能写出这样的:
for (int i=1;i<=10;i++)
{
if(i==1||i==10)
{
for (int y = 1; y <= 10; y++)
{
Console.Write("*");
}
}
else
{
for (int z = 1; z <= 10; z++)
{
if (z == 1 || z == 10)
Console.Write("*");
else
Console.Write(" ");
}
}
Console.WriteLine();
}
谢谢大佬们!
for (int a = 0; a < 10; a++)
{
for (int b = 0; b < 10; b++)
{
if ((a != 0 && a != 9) && (b != 0 && b != 9))
Console.Write(' ');
else
Console.Write('*');
}
Console.WriteLine();
}