为什么用ASP.NET打印九九乘法表不是乘法表的形式呢
txtStart是开始值的文本框名称,txtEnd是结束值的文本框名称,如果在开始值写1,结束值写9,程序运行出来,就是9*9=81,不是乘法表的形式,不知道为什么using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
public partial class _9_9 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void btnSubmit_Click(object sender, EventArgs e)
{
if (Convert.ToInt32(txtStart.Text.ToString())<1||(Convert.ToInt32(txtEnd.Text.ToString())>9))
{
lblMessage.Text = "对不起,您输入的值不符合";
}
else
{
for (int i = Convert.ToInt32(txtStart.Text.Trim()); i <=Convert.ToInt32(txtEnd.Text.Trim()); i++)
{
for (int j = 1; j <=i; j++)
{
lblMessage.Text = i + "*" + j + "=" + i * j;
}
}
}
}
}
希望高手们帮我看看,谢谢