2010年10月1日 星期五

表單-九九乘法表

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 Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }
        private void button1_Click(object sender, EventArgs e)
        {
            int[,] array = new int[10, 10];
            for (int i= 1; i<= 9; i++)
            {
                for (int j = 1; j<= 9; j++)
                {
                    array[i, j] = i* j;
                }
            }
            for (int x = 1; x<= 9; x++)
            {
                listBox1.Items.Add("" + x+ "*1=" + array[x, 1] + "  " + x + "*2=" + array[x, 2] + "  " + x+ "*3=" + array[x, 3] + "  " + x + "*4=" + array[x, 4] + "  " + x + "*5=" + array[x, 5] + "  " + x + "*6=" + array[x, 6] + "  " + x+ "*7=" + array[x, 7] + "  " + x + "*8=" + array[x, 8] + "  " + x + "*9=" + array[x,9]);
            }
        }
    }
}

沒有留言:

張貼留言