C#.NET Program 8

Output:





















Code:

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 Question_8
{
    public partial class Form1 : Form
    {
        int num = 0;
        public Form1()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            num = int.Parse(textBox1.Text);

            for (int a = 1; a <= 10; a++)
            {
                listBox1.Items.Add(num + " X " + a + " \n = " + num * a);
            }
        }

        private void button2_Click(object sender, EventArgs e)
        {
            listBox1.Items.Clear();
            textBox1.Clear();
        }
    }
}

No comments:

Post a Comment