using System;
using System.Windows.Forms;

namespace _7_13
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        public static int GCD(int a, int b)
        {
            while (b != 0)
            {
                if (a > b)
                    a = a - b;
                else
                    b = b - a;
            }
            return a;
        }

        public static int LCM(int a, int b)
        {
            return (a * b) / GCD(a, b);
        }

        private void button1_Click(object sender, EventArgs e)
        {
            int a = Convert.ToInt32(textBox1.Text);
            int b = Convert.ToInt32(textBox2.Text);
            
            MessageBox.Show("B.M.M: " + GCD(a, b).ToString());
        }

        private void button2_Click(object sender, EventArgs e)
        {
            int a = Convert.ToInt32(textBox1.Text);
            int b = Convert.ToInt32(textBox2.Text);
            
            MessageBox.Show("K.M.M: " + LCM(a, b).ToString());
        }
    }
}