最大公约数&最小公倍数算法
using System;
using System.Collections.Generic;
using System.Text;
namespace ConsoleApplication1
{
public class Program
{
static void Main(string[] args)
{
divisor a = new divisor();
multiple b = new multiple();
Console.WriteLine("{0}",a.d(4,14));
Console.WriteLine("{0}", b.m(4,14));
}
}
class divisor
{
public int d(int m, int n)
{
if (m % n == 0) return n;
else return d(n, m % n);
}
}
class multiple
{
public int m(int a,int b)
{
int t = 0;
divisor c = new divisor();
t=c.d(a,b);
return (a * b / t);
}
}
}