2010年10月1日 星期五

九九乘法 part2

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace WindowsFormsApplication1
{
    public partial class Form2 : Form
    {
        public Form2()
        {
            InitializeComponent();
        }
        private void button1_Click(object sender, EventArgs e)
        {
            int[,] array = new int[10, 10];
            for (int x = 1; x <= 9; x++)
            {
                for (int y = 1; y <= 9; y++)
                {
                    array[x, y] = x * y;
                }
            }
            for (int z = 1; z <= 9; z++)
            {
                listBox1.Items.Add("" + z + "*1=" + array[z, 1] + "" + z + "*2=" + array[z, 2] + "" + z+ "*3=" + array[z, 3] + "" + z+ "*4=" + array[z, 4] + "" + z + "*5=" + array[z, 5] + "" + z + "*6=" + array[z, 6] + "" + z + "*7=" + array[z, 7] + "" + z+ "*8=" + array[z, 8] + "" + z + "*9=" + array[z, 9]);
            }
        }
    }
}

沒有留言:

張貼留言