
算法
nethub2
这个作者很懒,什么都没留下…
展开
-
求2个数的最大公约数 - 轮除法
求2个数的最大公约数 - 轮除法 public class C1{ public int getCommonDivisior(int a, int b){ int temp; if(a<=b){ temp = b; b = a; a = temp; } while (b!=0){ temp = a%b; a=b; b...原创 2013-12-10 16:27:18 · 244 阅读 · 0 评论 -
求2个数的最大公约数 - 递归+除法
public class Test { /** * @param args */ public static void main(String[] args) { getLowestTerms(12,28); } public static void getLowestTerms(int a, int b){ System.out.print...原创 2013-12-10 16:47:01 · 192 阅读 · 0 评论