Simple Calculator in Visual Programming C Sharp

By | August 20, 2023

Simple Calculator in Visual Programming C Sharp

Simple Calculator in Visual Programming C Sharp

Simple Calculator in Visual Programming C Sharp


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

        private void textBox1_TextChanged(object sender, EventArgs e)
        {

        }

        private void button1_Click(object sender, EventArgs e)
        {
            int n1, n2, result;

            n1 = int.Parse(textBox1.Text);
            n2 = int.Parse(textBox2.Text);
            result=n1+n2;
            textBox3.Text = result.ToString(); 
        }

        private void button2_Click(object sender, EventArgs e)
        {
            int n1, n2, result;

            n1 = int.Parse(textBox1.Text);
            n2 = int.Parse(textBox2.Text);
            result = n1 - n2;
            textBox3.Text = result.ToString();
        }

        private void button3_Click(object sender, EventArgs e)
        {
            int n1, n2, result;

            n1 = int.Parse(textBox1.Text);
            n2 = int.Parse(textBox2.Text);
            result = n1 * n2;
            textBox3.Text = result.ToString();
        }

        private void button4_Click(object sender, EventArgs e)
        {
            int n1, n2, result;

            n1 = int.Parse(textBox1.Text);
            n2 = int.Parse(textBox2.Text);
            result = n1 / n2;
            textBox3.Text = result.ToString();
        }
    }
}


Loading

Leave a Reply

Your email address will not be published. Required fields are marked *