Hàm tìm ước số chung lớn nhất của 2 số nguyên a, b bằng đệ quy

int UCLN(int a,int b)
{
       if(a==b)
        return a;
    else
    {
            if(a>b)
                    a=a-b;
           else
                  b=b-a;
     }
    return UCLN(a,b);
}

Share this

Related Posts

Previous
Next Post »