public class Main {
public static void main(String[] args) {
System.out.println(gcd(4,8));
}
//辗转相除法
public static int gcd(int x, int y){
if(y == 0)
return x;
else
return gcd(y,x%y);
}
}
原文地址:https://www.cnblogs.com/sgbe/p/11413331.html
时间: 2024-10-12 05:17:42