C# calculator to do n number of calculations : 
 namespace MyCalculatorv1    
{    
    public partial class MainWindow : Window    
    {    
        public MainWindow()    
        {    
            InitializeComponent();    
        }    
    
        private void Button_Click_1(object sender, RoutedEventArgs e)    
        {    
            Button b = (Button) sender;    
            tb.Text += b.Content.ToString();

          
        }

        private void Result_click(object sender, RoutedEventArgs e)
        {
            try
            {
                result();
            }
            catch (Exception exc)
            {
                tb.Text = "Error!";
            }
        }    
    
    
        private void result()    
        {    
            String op;    
            int iOp = 0;    
            if (tb.Text.Contains("+"))    
            {    
                iOp = tb.Text.IndexOf("+");    
            }
            else if (tb.Text.Contains("-"))
            {
                iOp = tb.Text.IndexOf("-");
            }    
            else if (tb.Text.Contains("*"))    
            {    
                iOp = tb.Text.IndexOf("*");    
            }    
            else if (tb.Text.Contains("/"))    
            {    
                iOp = tb.Text.IndexOf("/");    
            }    
            else    
            {    
                //error    
            }    
                
            op = tb.Text.Substring(iOp, 1);    
            double op1 = Convert.ToDouble(tb.Text.Substring(0, iOp));    
            double op2 = Convert.ToDouble(tb.Text.Substring(iOp + 1, tb.Text.Length - iOp - 1));    
    
            if (op == "+")    
            {    
                tb.Text += "=" + (op1 + op2);    
            }
            else if (op == "-")
            {
                tb.Text += "=" + (op1 - op2);
            }   
            else if (op == "*")    
            {    
                tb.Text += "=" + (op1 * op2);    
            }    
            else    
            {    
                tb.Text += "=" + (op1 / op2);    
            }    
        }


        private void Off_Click_1(object sender, RoutedEventArgs e)
        {
            Application.Current.Shutdown();
        }    
    

    
        private void Del_Click(object sender, RoutedEventArgs e)    
        {    
            tb.Text = "";    
        }    
    
        private void R_Click(object sender, RoutedEventArgs e)    
        {    
            if (tb.Text.Length > 0)    
            {    
                tb.Text = tb.Text.Substring(0, tb.Text.Length - 1);    
            }    
        }    
    }    
}    


 namespace MyCalculatorv1    
{    
    public partial class MainWindow : Window    
    {    
        public MainWindow()    
        {    
            InitializeComponent();    
        }    
    
        private void Button_Click_1(object sender, RoutedEventArgs e)    
        {    
            Button b = (Button) sender;    
            tb.Text += b.Content.ToString();

          
        }

        private void Result_click(object sender, RoutedEventArgs e)
        {
            try
            {
                result();
            }
            catch (Exception exc)
            {
                tb.Text = "Error!";
            }
        }    
    
    
        private void result()    
        {    
            String op;    
            int iOp = 0;    
            if (tb.Text.Contains("+"))    
            {    
                iOp = tb.Text.IndexOf("+");    
            }
            else if (tb.Text.Contains("-"))
            {
                iOp = tb.Text.IndexOf("-");
            }    
            else if (tb.Text.Contains("*"))    
            {    
                iOp = tb.Text.IndexOf("*");    
            }    
            else if (tb.Text.Contains("/"))    
            {    
                iOp = tb.Text.IndexOf("/");    
            }    
            else    
            {    
                //error    
            }    
                
            op = tb.Text.Substring(iOp, 1);    
            double op1 = Convert.ToDouble(tb.Text.Substring(0, iOp));    
            double op2 = Convert.ToDouble(tb.Text.Substring(iOp + 1, tb.Text.Length - iOp - 1));    
    
            if (op == "+")    
            {    
                tb.Text += "=" + (op1 + op2);    
            }
            else if (op == "-")
            {
                tb.Text += "=" + (op1 - op2);
            }   
            else if (op == "*")    
            {    
                tb.Text += "=" + (op1 * op2);    
            }    
            else    
            {    
                tb.Text += "=" + (op1 / op2);    
            }    
        }


        private void Off_Click_1(object sender, RoutedEventArgs e)
        {
            Application.Current.Shutdown();
        }    
    

    
        private void Del_Click(object sender, RoutedEventArgs e)    
        {    
            tb.Text = "";    
        }    
    
        private void R_Click(object sender, RoutedEventArgs e)    
        {    
            if (tb.Text.Length > 0)    
            {    
                tb.Text = tb.Text.Substring(0, tb.Text.Length - 1);    
            }    
        }    
    }    
}    



//Hi friends In this code calculator is counting only two values, and I need to do a calculator which can do n number of calculations such as division multiplication addition and subtraction..by using this code so please do help me
`//







