using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Least Common Multiple
{
class Program
{
static void Main(string[] args)
{
string a;
string b;
Console.WriteLine("a&b:");
a = Console.ReadLine();
b = Console.ReadLine();
int a1 = Int32.Parse(a);
int b1 = Int32.Parse(b);
int x;
if (a1 > b1)
{
x = a1;
}
else
{
x = b1;
}
int c1, c2;
c1 = x % a1;
c2 = x % b1;
while (c1 != 0 || c2 != 0)
{
x++;
c1 = x % a1;
c2 = x % b1;
}
Console.WriteLine("Result : " + x);
Console.ReadLine();
}
}
}
تصویر ادامه ی مطلب ک.م.م(Least Common Multiple):