C#
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace form11
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button2_Click(object sender, EventArgs e)
{
Close();
}
private void button1_Click(object sender, EventArgs e)
{
//Console.WriteLine("输入两个数:");
int Q, R,i;
Q = int.Parse(textBox1.Text);
R = int.Parse(textBox2.Text);
if(Q!=R)
{
for (i = 0; Q != R;i++ )
if (Q > R)
{
Q = Q - R;
}
else
{
R = R - Q;
}
label1.Text = ((int.Parse(textBox1.Text)) + "和" + (int.Parse(textBox2.Text)) + "的最大公倍数是:" + Q);
}
else
{
label1.Text = ((int.Parse(textBox1.Text)) + "和"+(int.Parse(textBox2.Text)) + "的最大公倍数是:" + Q);
}
}
}
}