using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace WindowsApplication1
{
    public partial class Form1 : Form
    {
        string maintex = "0.";
        bool fristaction=true;
        bool momz=false;
        bool frist;
        double m1, m2,result;
        string a;
        double memory;
        public Form1()
        {
            InitializeComponent();
        }

        private void textBox1_TextChanged(object sender, EventArgs e)
        {
            
        }

        private void button14_Click(object sender, EventArgs e)
        {
            if (a != "")
            {
                if (frist == true)
                {
                    if (a == "+")
                    {
                        maintex = textBox1.Text;
                        m2 = double.Parse(maintex);
                        result = m1 + m2;
                        textBox1.Text = result.ToString();
                        a = "";
                        m1 = result;
                        frist = false;
                        momz = false;
                    }
                    else if (a == "-")
                    {
                        maintex = textBox1.Text;
                        m2 = double.Parse(maintex);
                        result = m1 - m2;
                        textBox1.Text = result.ToString();
                        a = "";
                        m1 = result;
                        frist = false;
                        momz = false;
                    }
                    else if (a == "*")
                    {
                        maintex = textBox1.Text;
                        m2 = double.Parse(maintex);
                        result = m1 * m2;
                        textBox1.Text = result.ToString();
                        a = "";
                        m1 = result;
                        frist = false;
                        momz = false;
                    }
                    else if (a == "^")
                    {
                        maintex = textBox1.Text;
                        m2 = double.Parse(maintex);
                        result = Math.Pow(m1, m2);
                        textBox1.Text = result.ToString();
                        a = "";
                        m1 = result;
                        frist = false;
                        momz = false;
                    }
                    else if (a == "/")
                    {
                        maintex = textBox1.Text;
                        m2 = double.Parse(maintex);
                        if (m2 == 0)
                        {
                            MessageBox.Show("Division By IT2", "web.com");
                            fristaction = true;
                            a = "";
                        }
                        else
                        {
                            result = m1 / m2;
                            textBox1.Text = result.ToString();
                            a = "";
                            m1 = result;
                            frist = false;
                            momz = false;
                        }
                    }

                }
            }
            if (frist == false)
            {
                if (momz == false)
                {
                    maintex = textBox1.Text;
                    m1 = double.Parse(maintex);
                    fristaction = true;
                    a="+";
                    frist = true;
                    momz = false;
                }
                else if (momz == true)
                {
                    maintex = textBox1.Text;
                    m1 = double.Parse(maintex);
                    fristaction = true;
                    a="+";
                    frist = true;
                    momz = false;
                }
            }
            else if (frist == true)
            {
                if (momz == false)
                {
                    maintex = textBox1.Text;
                    m2 = double.Parse(maintex);
                    result = m1 + m2;
                    textBox1.Text = result.ToString();
                    m1 = result;
                    fristaction = true;
                    a = "";
                    momz = false;
                }
                else if (momz == true)
                {
                    maintex = textBox1.Text;
                    m2 = double.Parse(maintex);
                    fristaction = true;
                    result = m1 + m2;
                    textBox1.Text = result.ToString();
                    m1 = result;
                    a = "";
                    momz = false;
                }
            }
        }

        private void button1_Click(object sender, EventArgs e)
        {
            if (fristaction == true && momz==false)
            {
                textBox1.Text ="1" + ".";
                fristaction = false;
            }
            else if (fristaction == false && momz==false)
            {
                maintex = textBox1.Text;
                maintex = maintex.Substring(0, (maintex.Length) - 1);
                maintex = maintex + "1" + ".";
                textBox1.Text=maintex;
            }
            if (fristaction == true && momz ==true)
            {
                textBox1.Text = "0." + "1";
                fristaction = false;
            }
            else if (fristaction == false && momz == true)
            {
                maintex = textBox1.Text;
                maintex = maintex + "1";
                textBox1.Text = maintex;
            }
        }

        private void Form1_Load(object sender, EventArgs e)
        {
            textBox1.Text = maintex;
        }

        private void button2_Click(object sender, EventArgs e)
        {
            if (fristaction == true && momz == false)
            {
                textBox1.Text = "2" + ".";
                fristaction = false;
            }
            else if (fristaction == false && momz == false)
            {
                maintex = textBox1.Text;
                maintex = maintex.Substring(0, (maintex.Length) - 1);
                maintex = maintex + "2" + ".";
                textBox1.Text = maintex;
            }
            if (fristaction == true && momz == true)
            {
                textBox1.Text = "0." + "2";
                fristaction = false;
            }
            else if (fristaction == false && momz == true)
            {
                maintex = textBox1.Text;
                maintex = maintex + "2";
                textBox1.Text = maintex;
            }
        }

        private void button3_Click(object sender, EventArgs e)
        {
            if (fristaction == true && momz == false)
            {
                textBox1.Text = "3" + ".";
                fristaction = false;
            }
            else if (fristaction == false && momz == false)
            {
                maintex = textBox1.Text;
                maintex = maintex.Substring(0, (maintex.Length) - 1);
                maintex = maintex + "3" + ".";
                textBox1.Text = maintex;
            }
            if (fristaction == true && momz == true)
            {
                textBox1.Text = "0." + "3";
                fristaction = false;
            }
            else if (fristaction == false && momz == true)
            {
                maintex = textBox1.Text;
                maintex = maintex + "3";
                textBox1.Text = maintex;
            }
        }

        private void button4_Click(object sender, EventArgs e)
        {
            if (fristaction == true && momz == false)
            {
                textBox1.Text = "4" + ".";
                fristaction = false;
            }
            else if (fristaction == false && momz == false)
            {
                maintex = textBox1.Text;
                maintex = maintex.Substring(0, (maintex.Length) - 1);
                maintex = maintex + "4" + ".";
                textBox1.Text = maintex;
            }
            if (fristaction == true && momz == true)
            {
                textBox1.Text = "0." + "4";
                fristaction = false;
            }
            else if (fristaction == false && momz == true)
            {
                maintex = textBox1.Text;
                maintex = maintex + "4";
                textBox1.Text = maintex;
            }
        }

        private void button5_Click(object sender, EventArgs e)
        {
            if (fristaction == true && momz == false)
            {
                textBox1.Text = "5" + ".";
                fristaction = false;
            }
            else if (fristaction == false && momz == false)
            {
                maintex = textBox1.Text;
                maintex = maintex.Substring(0, (maintex.Length) - 1);
                maintex = maintex + "5" + ".";
                textBox1.Text = maintex;
            }
            if (fristaction == true && momz == true)
            {
                textBox1.Text = "0." + "5";
                fristaction = false;
            }
            else if (fristaction == false && momz == true)
            {
                maintex = textBox1.Text;
                maintex = maintex + "5";
                textBox1.Text = maintex;
            }
        }

        private void button6_Click(object sender, EventArgs e)
        {
            if (fristaction == true && momz == false)
            {
                textBox1.Text = "6" + ".";
                fristaction = false;
            }
            else if (fristaction == false && momz == false)
            {
                maintex = textBox1.Text;
                maintex = maintex.Substring(0, (maintex.Length) - 1);
                maintex = maintex + "6" + ".";
                textBox1.Text = maintex;
            }
            if (fristaction == true && momz == true)
            {
                textBox1.Text = "0." + "6";
                fristaction = false;
            }
            else if (fristaction == false && momz == true)
            {
                maintex = textBox1.Text;
                maintex = maintex + "6";
                textBox1.Text = maintex;
            }
        }

        private void button7_Click(object sender, EventArgs e)
        {
            if (fristaction == true && momz == false)
            {
                textBox1.Text = "7" + ".";
                fristaction = false;
            }
            else if (fristaction == false && momz == false)
            {
                maintex = textBox1.Text;
                maintex = maintex.Substring(0, (maintex.Length) - 1);
                maintex = maintex + "7" + ".";
                textBox1.Text = maintex;
            }
            if (fristaction == true && momz == true)
            {
                textBox1.Text = "0." + "7";
                fristaction = false;
            }
            else if (fristaction == false && momz == true)
            {
                maintex = textBox1.Text;
                maintex = maintex + "7";
                textBox1.Text = maintex;
            }
        }

        private void button8_Click(object sender, EventArgs e)
        {
            if (fristaction == true && momz == false)
            {
                textBox1.Text = "8" + ".";
                fristaction = false;
            }
            else if (fristaction == false && momz == false)
            {
                maintex = textBox1.Text;
                maintex = maintex.Substring(0, (maintex.Length) - 1);
                maintex = maintex + "8" + ".";
                textBox1.Text = maintex;
            }
            if (fristaction == true && momz == true)
            {
                textBox1.Text = "0." + "8";
                fristaction = false;
            }
            else if (fristaction == false && momz == true)
            {
                maintex = textBox1.Text;
                maintex = maintex + "8";
                textBox1.Text = maintex;
            }
        }

        private void button9_Click(object sender, EventArgs e)
        {
            if (fristaction == true && momz == false)
            {
                textBox1.Text = "9" + ".";
                fristaction = false;
            }
            else if (fristaction == false && momz == false)
            {
                maintex = textBox1.Text;
                maintex = maintex.Substring(0, (maintex.Length) - 1);
                maintex = maintex + "9" + ".";
                textBox1.Text = maintex;
            }
            if (fristaction == true && momz == true)
            {
                textBox1.Text = "0." + "9";
                fristaction = false;
            }
            else if (fristaction == false && momz == true)
            {
                maintex = textBox1.Text;
                maintex = maintex + "9";
                textBox1.Text = maintex;
            }
        }

        private void button10_Click(object sender, EventArgs e)
        {
            if (fristaction == false && momz == false)
            {
                maintex = textBox1.Text;
                maintex = maintex.Substring(0, (maintex.Length) - 1);
                maintex = maintex + "0" + ".";
                textBox1.Text = maintex;
            }
            if (fristaction == false && momz == true)
            {
                maintex = textBox1.Text;
                maintex = maintex + "0";
                textBox1.Text = maintex;
            }

        }

        private void button12_Click(object sender, EventArgs e)
        {
            if (fristaction == false && momz == false)
            {
                maintex = textBox1.Text;
                maintex = maintex.Substring(0, (maintex.Length) - 1);
                maintex = maintex + "00" + ".";
                textBox1.Text = maintex;
            }
            if (fristaction == false && momz == true)
            {
                maintex = textBox1.Text;
                maintex = maintex + "00";
                textBox1.Text = maintex;
            }
        }

        private void button11_Click(object sender, EventArgs e)
        {
            momz = true;
        }

        private void button23_Click(object sender, EventArgs e)
        {
            memory = 0;
        }

        private void button15_Click(object sender, EventArgs e)
        {
            if (a != "")
            {
                if (frist == true)
                {
                    if (a == "+")
                    {
                        maintex = textBox1.Text;
                        m2 = double.Parse(maintex);
                        result = m1 + m2;
                        textBox1.Text = result.ToString();
                        a = "";
                        m1 = result;
                        frist = false;
                        momz = false;
                    }
                    else if (a == "-")
                    {
                        maintex = textBox1.Text;
                        m2 = double.Parse(maintex);
                        result = m1 - m2;
                        textBox1.Text = result.ToString();
                        a = "";
                        m1 = result;
                        frist = false;
                        momz = false;
                    }
                    else if (a == "*")
                    {
                        maintex = textBox1.Text;
                        m2 = double.Parse(maintex);
                        result = m1 * m2;
                        textBox1.Text = result.ToString();
                        a = "";
                        m1 = result;
                        frist = false;
                        momz = false;
                    }
                    else if (a == "^")
                    {
                        maintex = textBox1.Text;
                        m2 = double.Parse(maintex);
                        result = Math.Pow(m1, m2);
                        textBox1.Text = result.ToString();
                        a = "";
                        m1 = result;
                        frist = false;
                        momz = false;
                    }
                    else if (a == "/")
                    {
                        maintex = textBox1.Text;
                        m2 = double.Parse(maintex);
                        if (m2 == 0)
                        {
                            MessageBox.Show("Division By IT2", "web.com");
                            fristaction = true;
                            a = "";
                        }
                        else
                        {
                            result = m1 / m2;
                            textBox1.Text = result.ToString();
                            a = "";
                            m1 = result;
                            frist = false;
                            momz = false;
                        }
                    }

                }
            }
            if (frist == false)
            {
                if (momz == false)
                {
                    maintex = textBox1.Text;
                    m1 = double.Parse(maintex);
                    fristaction = true;
                    a = "-";
                    frist = true;
                    momz = false;
                }
                else if (momz == true)
                {
                    maintex = textBox1.Text;
                    m1 = double.Parse(maintex);
                    fristaction = true;
                    a = "-";
                    frist = true;
                    momz = false;
                }
            }
            else if (frist == true)
            {
                if (momz == false)
                {
                    maintex = textBox1.Text;
                    m2 = double.Parse(maintex);
                    result = m1 - m2;
                    textBox1.Text = result.ToString();
                    m1 = result;
                    fristaction = true;
                    a = "";
                    momz = false;
                }
                else if (momz == true)
                {
                    maintex = textBox1.Text;
                    m2 = double.Parse(maintex);
                    fristaction = true;
                    result = m1 - m2;
                    textBox1.Text = result.ToString();
                    m1 = result;
                    momz = false;
                    a = "";
                }
            }
        }

        private void button16_Click(object sender, EventArgs e)
        {
            if (a != "")
            {
                if (frist == true)
                {
                    if (a == "+")
                    {
                        maintex = textBox1.Text;
                        m2 = double.Parse(maintex);
                        result = m1 + m2;
                        textBox1.Text = result.ToString();
                        a = "";
                        m1 = result;
                        frist = false;
                        momz = false;
                    }
                    else if (a == "-")
                    {
                        maintex = textBox1.Text;
                        m2 = double.Parse(maintex);
                        result = m1 - m2;
                        textBox1.Text = result.ToString();
                        a = "";
                        m1 = result;
                        frist = false;
                        momz = false;
                    }
                    else if (a == "*")
                    {
                        maintex = textBox1.Text;
                        m2 = double.Parse(maintex);
                        result = m1 * m2;
                        textBox1.Text = result.ToString();
                        a = "";
                        m1 = result;
                        frist = false;
                        momz = false;
                    }
                    else if (a == "^")
                    {
                        maintex = textBox1.Text;
                        m2 = double.Parse(maintex);
                        result = Math.Pow(m1, m2);
                        textBox1.Text = result.ToString();
                        a = "";
                        m1 = result;
                        frist = false;
                        momz = false;
                    }
                    else if (a == "/")
                    {
                        maintex = textBox1.Text;
                        m2 = double.Parse(maintex);
                        if (m2 == 0)
                        {
                            MessageBox.Show("Division By IT2", "web.com");
                            fristaction = true;
                            a = "";
                        }
                        else
                        {
                            result = m1 / m2;
                            textBox1.Text = result.ToString();
                            a = "";
                            m1 = result;
                            frist = false;
                            momz = false;
                        }
                    }

                }
            }
            if (frist == false)
            {
                if (momz == false)
                {
                    maintex = textBox1.Text;
                    m1 = double.Parse(maintex);
                    fristaction = true;
                    a = "*";
                    frist = true;
                    momz = false;
                }
                else if (momz == true)
                {
                    maintex = textBox1.Text;
                    m1 = double.Parse(maintex);
                    fristaction = true;
                    a = "*";
                    frist = true;
                    momz = false;
                }
            }
            else if (frist == true)
            {
                if (momz == false)
                {
                    maintex = textBox1.Text;
                    m2 = double.Parse(maintex);
                    a = "";
                    result = m1 * m2;
                    textBox1.Text = result.ToString();
                    m1 = result;
                    fristaction = true;
                    momz = false;
                }
                else if (momz == true)
                {
                    maintex = textBox1.Text;
                    m2 = double.Parse(maintex);
                    fristaction = true;
                    a = "";
                    result = m1 * m2;
                    textBox1.Text = result.ToString();
                    m1 = result;
                    momz = false;
                }
            }
        }

        private void button19_Click(object sender, EventArgs e)
        {
            if (a != "")
            {
                if (frist == true)
                {
                    if (a == "+")
                    {
                        maintex = textBox1.Text;
                        m2 = double.Parse(maintex);
                        result = m1 + m2;
                        textBox1.Text = result.ToString();
                        a = "";
                        m1 = result;
                        frist = false;
                        momz = false;
                    }
                    else if (a == "-")
                    {
                        maintex = textBox1.Text;
                        m2 = double.Parse(maintex);
                        result = m1 - m2;
                        textBox1.Text = result.ToString();
                        a = "";
                        m1 = result;
                        frist = false;
                        momz = false;
                    }
                    else if (a == "*")
                    {
                        maintex = textBox1.Text;
                        m2 = double.Parse(maintex);
                        result = m1 * m2;
                        textBox1.Text = result.ToString();
                        a = "";
                        m1 = result;
                        frist = false;
                        momz = false;
                    }
                    else if (a == "^")
                    {
                        maintex = textBox1.Text;
                        m2 = double.Parse(maintex);
                        result = Math.Pow(m1, m2);
                        textBox1.Text = result.ToString();
                        a = "";
                        m1 = result;
                        frist = false;
                        momz = false;
                    }
                    else if (a == "/")
                    {
                        maintex = textBox1.Text;
                        m2 = double.Parse(maintex);
                        if (m2 == 0)
                        {
                            MessageBox.Show("Division By IT2", "web.com");
                            fristaction = true;
                            a = "";
                        }
                        else
                        {
                            result = m1 / m2;
                            textBox1.Text = result.ToString();
                            a = "";
                            m1 = result;
                            frist = false;
                            momz = false;
                        }
                    }

                }
            }
            if (frist == false)
            {
                if (momz == false)
                {
                    maintex = textBox1.Text;
                    m1 = double.Parse(maintex);
                    fristaction = true;
                    a = "^";
                    frist = true;
                    momz = false;
                }
                else if (momz == true)
                {
                    maintex = textBox1.Text;
                    m1 = double.Parse(maintex);
                    fristaction = true;
                    a = "^";
                    frist = true;
                    momz = false;
                }
            }
            else if (frist == true)
            {
                if (momz == false)
                {
                    maintex = textBox1.Text;
                    m2 = double.Parse(maintex);
                    a = "";
                    result = Math.Pow(m1, m2);
                    textBox1.Text = result.ToString();
                    m1 = result;
                    fristaction = true;
                    momz = false;
                }
                else if (momz == true)
                {
                    maintex = textBox1.Text;
                    m2 = double.Parse(maintex);
                    fristaction = true;
                    a = "";
                    result = Math.Pow(m1,m2);
                    textBox1.Text = result.ToString();
                    m1 = result;
                    momz = false;
                }
            }
        }

        private void button17_Click(object sender, EventArgs e)
        {
            if (a != "")
            {
                if (frist == true)
                {
                    if (a == "+")
                    {
                        maintex = textBox1.Text;
                        m2 = double.Parse(maintex);
                        result = m1 + m2;
                        textBox1.Text = result.ToString();
                        a = "";
                        m1 = result;
                        frist = false;
                        momz = false;
                    }
                    else if (a == "-")
                    {
                        maintex = textBox1.Text;
                        m2 = double.Parse(maintex);
                        result = m1 - m2;
                        textBox1.Text = result.ToString();
                        a = "";
                        m1 = result;
                        frist = false;
                        momz = false;
                    }
                    else if (a == "*")
                    {
                        maintex = textBox1.Text;
                        m2 = double.Parse(maintex);
                        result = m1 * m2;
                        textBox1.Text = result.ToString();
                        a = "";
                        m1 = result;
                        frist = false;
                        momz = false;
                    }
                    else if (a == "^")
                    {
                        maintex = textBox1.Text;
                        m2 = double.Parse(maintex);
                        result = Math.Pow(m1, m2);
                        textBox1.Text = result.ToString();
                        a = "";
                        m1 = result;
                        frist = false;
                        momz = false;
                    }
                    else if (a == "/")
                    {
                        maintex = textBox1.Text;
                        m2 = double.Parse(maintex);
                        if (m2 == 0)
                        {
                            MessageBox.Show("Division By IT2", "web.com");
                            fristaction = true;
                            a = "";
                        }
                        else
                        {
                            result = m1 / m2;
                            textBox1.Text = result.ToString();
                            a = "";
                            m1 = result;
                            frist = false;
                            momz = false;
                        }
                    }

                }
            }
            if (frist == false)
            {
                if (momz == false)
                {
                    maintex = textBox1.Text;
                    m1 = double.Parse(maintex);
                    fristaction = true;
                    a = "/";
                    frist = true;
                    momz = false;
                }
                else if (momz == true)
                {
                    maintex = textBox1.Text;
                    m1 = double.Parse(maintex);
                    fristaction = true;
                    a = "/";
                    frist = true;
                    momz = false;
                }
            }
            else if (frist == true)
            {
                if (momz == false)
                {
                    maintex = textBox1.Text;
                    m2 = double.Parse(maintex);
                    if (m2 == 0)
                    {
                        MessageBox.Show("Division By IT2", "web.com");
                        fristaction = true;
                        a = "";
                        momz = false;
                    }
                    else
                    {
                        result = m1 / m2;
                        textBox1.Text = result.ToString();
                        m1 = result;
                        fristaction = true;
                        a = "";
                        momz = false;
                    }
                }
                else if (momz == true)
                {
                    maintex = textBox1.Text;
                    m2 = double.Parse(maintex);
                    if (m2 == 0)
                    {
                        MessageBox.Show("Division By IT2", "web.com");
                        fristaction = true;
                        a = "";
                        momz = false;
                    }
                    else
                    {
                        fristaction = true;
                        result = m1 / m2;
                        textBox1.Text = result.ToString();
                        m1 = result;
                        a = "";
                        momz = false;
                    }
                }
            }
        }

        private void button13_Click(object sender, EventArgs e)
        {
            if (a != "")
            {
                if (frist == true)
                {
                    if (a == "+")
                    {
                        maintex = textBox1.Text;
                        m2 = double.Parse(maintex);
                        result = m1 + m2;
                        textBox1.Text = result.ToString();
                        a = "";
                        m1 = result;
                        frist = false;
                        momz = false;
                    }
                    else if (a == "-")
                    {
                        maintex = textBox1.Text;
                        m2 = double.Parse(maintex);
                        result = m1 - m2;
                        textBox1.Text = result.ToString();
                        a = "";
                        m1 = result;
                        frist = false;
                        momz = false;
                    }
                    else if (a == "*")
                    {
                        maintex = textBox1.Text;
                        m2 = double.Parse(maintex);
                        result = m1 * m2;
                        textBox1.Text = result.ToString();
                        a = "";
                        m1 = result;
                        frist = false;
                        momz = false;
                    }
                    else if (a == "^")
                    {
                        maintex = textBox1.Text;
                        m2 = double.Parse(maintex);
                        result = Math.Pow(m1, m2);
                        textBox1.Text = result.ToString();
                        a = "";
                        m1 = result;
                        frist = false;
                        momz = false;
                    }
                    else if (a == "/")
                    {
                        maintex = textBox1.Text;
                        m2 = double.Parse(maintex);
                        if (m2 == 0)
                        {
                            MessageBox.Show("Division By IT2", "web.com");
                            fristaction = true;
                            a = "";
                        }
                        else
                        {
                            result = m1 / m2;
                            textBox1.Text = result.ToString();
                            a = "";
                            m1 = result;
                            frist = false;
                            momz = false;
                        }
                    }
                }
            }
        }

        private void button18_Click(object sender, EventArgs e)
        {
            if (a != "")
            {
                if (frist == true)
                {
                    if (a == "+")
                    {
                        maintex = textBox1.Text;
                        m2 = double.Parse(maintex);
                        result = m1 + m2;
                        textBox1.Text = result.ToString();
                        a = "";
                        m1 = result;
                        frist = false;
                        momz = false;
                    }
                    else if (a == "-")
                    {
                        maintex = textBox1.Text;
                        m2 = double.Parse(maintex);
                        result = m1 - m2;
                        textBox1.Text = result.ToString();
                        a = "";
                        m1 = result;
                        frist = false;
                        momz = false;
                    }
                    else if (a == "*")
                    {
                        maintex = textBox1.Text;
                        m2 = double.Parse(maintex);
                        result = m1 * m2;
                        textBox1.Text = result.ToString();
                        a = "";
                        m1 = result;
                        frist = false;
                        momz = false;
                    }
                    else if (a == "^")
                    {
                        maintex = textBox1.Text;
                        m2 = double.Parse(maintex);
                        result = Math.Pow(m1, m2);
                        textBox1.Text = result.ToString();
                        a = "";
                        m1 = result;
                        frist = false;
                        momz = false;
                    }
                    else if (a == "/")
                    {
                        maintex = textBox1.Text;
                        m2 = double.Parse(maintex);
                        if (m2 == 0)
                        {
                            MessageBox.Show("Division By IT2", "web.com");
                            fristaction = true;
                            a = "";
                        }
                        else
                        {
                            result = m1 / m2;
                            textBox1.Text = result.ToString();
                            a = "";
                            m1 = result;
                            frist = false;
                            momz = false;
                        }
                    }
                }
            }
            maintex = textBox1.Text;
            m2 = double.Parse(maintex);
            result = Math.Sqrt(m2);
            textBox1.Text = result.ToString();
            m1 = result;
            frist = false;
            momz = false;
        }

        private void button20_Click(object sender, EventArgs e)
        {
            maintex = "0.";
            textBox1.Text = maintex;
            fristaction = true;
            frist = false;
            m1 = 0;
            m2 = 0;
            a = "";
            momz = false;
        }

        private void button21_Click(object sender, EventArgs e)
        {
            maintex = textBox1.Text;
            memory = memory+double.Parse(maintex);
        }

        private void button22_Click(object sender, EventArgs e)
        {
            textBox1.Text = memory.ToString();
        }
    }
}