In this tip, I show you how to multiply digits and show it as a table. This is helpful for kids to learn multiplication tables.
The basic idea of this software is understanding the "
for loop" function for beginners. The
for loop is a bit different. It's preferred when you know how many iterations you want, either because you know the exact amount of iterations, or because you have a variable containing the amount. The for loop in C# is useful for iterating over arrays and for sequential processing. The statements within the code block of a
for loop will execute a series of statements as long as a specific condition remains
Using the Code
It is very simple to understand how to use
for loops in your program.
Here is the code:
public partial class Form1 : Form
private string gettable(int a,int b,int c)
str = "";
for (int i = b; i <= c; i++)
str = str + a.ToString() + " X" + i.ToString() + "=" + (a * i) + "\n";
private void Form1_Load(object sender, EventArgs e)
private void btn1_Click(object sender, EventArgs e)
lbl1.Text = gettable(int.Parse(txt1.Text), int.Parse(txt2.Text),
private void btnexit_Click(object sender, EventArgs e)
private void btnclear_Click(object sender, EventArgs e)
txt1.Text = "";
txt2.Text = "";
txt3.Text = "";
lbl1.Text = "";
Points of Interest
So it's time to multiply with any digit. Have fun with the software table.