求两数最大公约数

2019-04-07  本文已影响0人  wolf_hugo

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.

上一篇下一篇

猜你喜欢

热点阅读