songjinze / BlogComment

博客评论仓库
0 stars 0 forks source link

最大公约数和最小公倍数 | SJZ's blog #75

Open songjinze opened 3 years ago

songjinze commented 3 years ago

https://songjinze.github.io/20200219/%E6%9C%80%E5%A4%A7%E5%85%AC%E7%BA%A6%E6%95%B0%E5%92%8C%E6%9C%80%E5%B0%8F%E5%85%AC%E5%80%8D%E6%95%B0/

最大公约数求法1. 辗转相除法public int getMaxCommonDivisor1(int a, int b){ int temp = 1; int aa = Math.max(a,b); int bb = Math.min(a,b); while(temp != 0){ temp = aa % bb; aa = bb;