You are on page 1of 1

using System;

using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApplication45
{
class Program
{
static void Main(string[] args)
{
int a,b,i,j,UCLN=1,BCNN;
Console.WriteLine("so a: ");
a = int.Parse(Console.ReadLine());
Console.WriteLine("so b:");
b = int.Parse(Console.ReadLine());
//
if (a > b)
j = a;
else
j = b;
for (i = 1; i <= j; i++)
{ if (a % i == 0 && b % i == 0)
UCLN = i; }
BCNN = a * b / UCLL;
Console.WriteLine("uoc chung lon nhat: " + UCLN);
Console.WriteLine("boi chung nho nhat: " + BCNN);

Console.ReadLine();

}
}
}

You might also like