Answer to Question #14904 in C# for Sifsilva

Question #14904
Write a program to display a a multiplication table such as young children use. A program should be capable of displaying a table of any size, specified by an integer entered into a text box.
1
Expert's answer
2012-09-14T10:48:46-0400
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 Table
{
public partial class Form1 : Form
{
& int x, y;
& public Form1()
& {
InitializeComponent();
& }

& private void buttonShowTable_Click(object sender, EventArgs e)
& {
StringBuilder table = new StringBuilder();
x = Convert.ToInt32(textBoxX.Text);
y = Convert.ToInt32(textBoxY.Text);

for (int i = 1; i < x+1; i++)
{
for (int j = 1; j < y+1; j++)
{
& table.Append(i.ToString()+" x "+j.ToString()+" = "+(i*j).ToString()+";\n");
}
table.Append("======================\n");
}
textboxOutput.Text = table.ToString();
& }
}
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS