用C#编程在屏幕上输出一个n行的金字塔图案,例如,若n=5,则图案

如题所述

第1个回答  推荐于2018-04-15
c# asp.net 写的代码 int line=5; // 行数 也就是你说的n
//控制输出多少行
for(int i=0;i<line;i++)
{
//输出空格
for (int x = 0; x < line-i; x++)
{
Response.Write(" ");
}
//输出星号
for(int y=0;y<2*i+1;y++)
{
Response.Write("*");
}
Response.Write( "<br>\n");
}本回答被网友采纳
第2个回答  2013-12-03
你是要程序?还是结果?
相似回答