int n = 5;
for (int i = 0; i < n; i++)
{
for (int k = n - 1; k >= i; k--)
{
Console.Write("王");
}
if (i == n - 1) //if (i < n - 1)//定位最后光标关键语句
break;
{
Console.WriteLine();
for (int j = 0; j <= i; j++)
{
Console.Write(" ");
}
}
}
Console.ReadKey();
写了一段,实在不知道怎么写了:
int i = 0, k = 5;
while (i < k)
{
i++;
Console.Write("王");
}
Console.ReadLine();
完全抄下就可以啊(要注意,i要最后加,因为中间用到)
static void Main(string[]args) {
int n = 5;
int i=0;
while(i<n)
{
int k=n-1;
while( k-- >= i)
{
Console.Write("王");
}
if (i==n-1)
break;
Console.WriteLine();
int j=0;
while(j++<=i)
{
Console.Write(" ");
}
i++;
}
Console.ReadKey();
}
一周热门 更多>