C#中如何用控制台输出反倒三角小九九
1个回答
展开全部
StringBuilder builder = new StringBuilder();
for (int i = 0; i <= N ; i++)
{
builder.Clear();
int Multipler = i;
if (i < 1)
{
builder.Append(" ");
Multipler = 1;
}
else
{
builder.Append(i.ToString());
}
for (int j = 1; j <= N; j++)
{
if (j < i)
builder.Append(" ");
else
builder.AppendFormat(" {0,2}", (j * Multipler));
}
Console.WriteLine(builder.ToString());
}
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询