40K的图上传还大.....
static void Main(string[] args)
{
int rows = 4;
Console.Write("输入需显示的行数.\r\n");
rows = Convert.ToInt16(Console.ReadLine());
if (rows < 1 || rows > 100)
{
Console.Write("输入不合法.\r\n");
return;
}
//start
for (int i = 1; i < rows + 1; i++)//control rows
{
for (int j = 0; j < (rows-i); j++ )//control cols [empty cols]
{
Console.Write(" ");
}
for (int j = 1; j <= i+(i-1); j++)
{
if (j > i) //write the back num =(rowsnumber-(colnumber-1))
Console.Write((i+(i-3))-(j-3));
else
Console.Write(j); //write the front num
}
Console.Write("\r\n");//new row
}
//pause
Console.Write("输入任意字符终止程序.\r\n");
string tp = Console.ReadLine();
}
static void Main(string[] args)
{
int rows = 4;
Console.Write("输入需显示的行数.\r\n");
rows = Convert.ToInt16(Console.ReadLine());
if (rows < 1 || rows > 100)
{
Console.Write("输入不合法.\r\n");
return;
}
//start
for (int i = 1; i < rows + 1; i++)//control rows
{
for (int j = 0; j < (rows-i); j++ )//control cols [empty cols]
{
Console.Write(" ");
}
for (int j = 1; j <= i+(i-1); j++)
{
if (j > i) //write the back num =(rowsnumber-(colnumber-1))
Console.Write((i+(i-3))-(j-3));
else
Console.Write(j); //write the front num
}
Console.Write("\r\n");//new row
}
//pause
Console.Write("输入任意字符终止程序.\r\n");
string tp = Console.ReadLine();
}
XAplus!
讨论群:51090447
删吧删吧,把我的号给删了!