언어/JAVA

JAVA 최대공약수 구하기

hazel_ 2021. 7. 23. 22:22
static int gcd(int a, int b) { //최대공약수 구하기
	if(a%b==0) {
		return b;
	}	
	return gcd(b, a%b);
}