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.
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.
本文标题:求两数最大公约数
本文链接:https://www.haomeiwen.com/subject/ofssiqtx.html
网友评论