Multiplication Table

 Print multiplication table into Listbox

Design:- 

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 Multiplication_Table
{
    public partial class frmtable : Form
    {
        public frmtable()
        {
            InitializeComponent();
        }

        private void textBox2_TextChanged(object sender, EventArgs e)
        {

        }

        private void btntable_Click(object sender, EventArgs e)
        {
            int i;
            int num = 0;
            int start = 0;
            int end = 0;
            num = Convert.ToInt32(txtnumbertable.Text);
            start = Convert.ToInt32(txtstartnumber.Text);
            end = Convert.ToInt32(txtendnumber.Text);

            for (i = start; i <= end; i++)
            {
                lstTable.Items.Add(num + " X " + i + " = " + (num * i)); 
            }
        }

        private void btnreseat_Click(object sender, EventArgs e)
        {
            txtendnumber.Text = " ";
            txtnumbertable.Text = " ";
            txtstartnumber.Text = " ";
            lstTable.Items.Clear();

        }

        private void btnexit_Click(object sender, EventArgs e)
        {
            Application.Exit();
        }
    }
}



No comments:

Post a Comment

Aarsh Prajapati

Welcome! Java Programs And Theory  Practical    Theory Java Basic Program Java Simple Program Array, Inheritance and Interface Program Packa...