求两数最大公约数

these are tow int a b,and c=min{a,b};

while(a%c!=0||b%c!=0){c--;}


another solution

make a>b;

int function(int a,int b){int c;c=a%b;while(a%b!=0){a=b;b=c;c=a%b;}return b;}


i dont know how to make the correct code format here,excuse me.

你可能感兴趣的:(求两数最大公约数)