asp.net 99乘法表制作

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace _925
{
    public partial class tableDemo : System.Web.UI.Page
    {
        public void getTable(int number)
        {
            int num = number;

        TableRow tr;
        TableCell td;
        for (int i = 0; i <= num; i++)
        {
            tr = new TableRow();
            for (int j = 1; j <= i; j++)
            {
                td = new TableCell();
                td.Text = i + "*" + j + "=" + i * j;
                tr.Cells.Add(td);

            }
            Table1.Rows.Add(tr);
        
            }
        
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                getTable(9);
               }

            }
        }
    }
}

你可能感兴趣的:(asp.net 99乘法表制作)