Created
October 24, 2015 01:41
-
-
Save tedliou/941251b2e29bbd045628 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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