改下包名即可运行
package cn.blk5;
public class CommonDivisor {
/**
* @author: LIWEI
* @updateTime: 2019-06-24 12:19
* 递归求两个数的最大公约数
*
*/
public static int cd(int a, int b) {
int res = a % b;
if (res == 0) {
return b;
} else {
return cd(b, res);
}
}
public static void main(String[] args) {
System.out.println(cd(345, 5555));
System.out.println(cd(5555, 345));
}
}