int Total = 27, // 记录 总数
Column = 8, // 每行显示的 列数
i = 1;
string Table = "
while (i <= Total)
{
int j = i % Column;
if (j == 1)
{
// j=1 时为新的一行的开始(第一列),输出
Table += "
";}
//Table += "
i=" + i + "j=" + j + "";
Table += "
ddddddd";if (j == 0) // j=1 时为一行的结束(最后一列),输出
{
Table += "";
}
i++;
}
if ((Total % Column) != 0) // Total%Column 不等于0,说明最后一行未填满
{
for (int n = 1; n <= (Column - (Total % Column)); n++) // 得到剩余的列数,循环用
填充{
Table += "
/";}
Table += "";
}
Table += "
";Response.Write(Table);