# C# : MDAS Calculator

0
87

Now, in this tutorial, I will show you how to create MDAS calculator in C#. MDAS are the four fundamental operations in the calculation which standÂ for Multiplication, Division, Addition and Subtraction that are very common to remember, sounds good right? So, if you want to create your own MDASÂ calculator? These easy steps below will guide you on how to do it.

## Let’s begin:

Open Microsoft Visual Studio 2008 and create a new windows form application. After that, do the form as follows.

Go to the solution explorer, hit the “code view” to fire the code editor.

In the code editor, declare a variable to represent the total of the MDAS.

`Â double total = 0;`

Do the following codes for Multiplication methods.

``` private void btnMultiply_Click(object sender, EventArgs e)
{
//set a formula for multiplication
total = double.Parse (txtFinput.Text) * double.Parse (txtSinput.Text);
lstOutput.Items.Add(double.Parse (txtFinput.Text) + " * " + double.Parse (txtSinput.Text) + " = " + total);
}```

Do the following codes for Division methods.

```private void btnDivide_Click(object sender, EventArgs e)
{
//set a formula for Division
total = double.Parse(txtFinput.Text) / double.Parse(txtSinput.Text);
lstOutput.Items.Add(double.Parse(txtFinput.Text) + " / " + double.Parse(txtSinput.Text) + " = " + total);
}```

Do the following codes for Addition methods.

``` private void btnAdd_Click(object sender, EventArgs e)
{
//set a formula for addition
total = double.Parse(txtFinput.Text) + double.Parse(txtSinput.Text);
lstOutput.Items.Add(double.Parse(txtFinput.Text) + " + " + double.Parse(txtSinput.Text) + " = " + total);
}```

Do the following codes for Subtraction methods.

``` private void btnSubtract_Click(object sender, EventArgs e)
{
//set a formula for subtraction
total = double.Parse(txtFinput.Text) - double.Parse(txtSinput.Text);
lstOutput.Items.Add(double.Parse(txtFinput.Text) + " - " + double.Parse(txtSinput.Text) + " = " + total);
}```

## Output:

For all students who need a programmer for your thesis system or anyone who needs a source code in any programming languages. You can contact me @ :

Email â€“ jannopalacios@gmail.com
Mobile No. â€“ 09305235027 â€“Â TNT