namespace lab1
{
class Program
{
static int nod (int a, int b)
{
if (a == b)
return a;
else
{
if (a > b)
return nod(a-b, b);
else
return nod(a, b-a);
}
}
static void Main(string[] args)
{
try
{
Console.Write("a= ");
int a = int.Parse(Console.ReadLine());
Console.Write("b= ");
int b = int.Parse(Console.ReadLine());
Console.Write("NOD(a,b)={0}",nod(a,b));
Console.ReadLine();
}
catch (System.Exception ex)
{
Console.WriteLine(ex.Message);
Console.ReadLine();
}
}
}
}