Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save tedliou/941251b2e29bbd045628 to your computer and use it in GitHub Desktop.
Save tedliou/941251b2e29bbd045628 to your computer and use it in GitHub Desktop.
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace 九九乘法表
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
int a,b,c; //宣告變數a,b,c
for (a = 1; a < 10; a++) //進行迴圈,使被乘數範圍為1到9
{
for (b = 1; b < 10; b++) //進行迴圈,使乘數範圍為1到9
{
c = a * b; //將變數a乘以變數b可得到變數數c,此為乘法中的商數
listBox1.Items.Add(a + " X " + b + " = " + c); //將計算中的被乘數、乘數、商數都能顯示在ListBox中
}
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment