Skip to content

Instantly share code, notes, and snippets.

@sbin0819
Created June 30, 2022 02:47
Show Gist options
  • Save sbin0819/b0f064e0a756eac07327925c60841bc2 to your computer and use it in GitHub Desktop.
Save sbin0819/b0f064e0a756eac07327925c60841bc2 to your computer and use it in GitHub Desktop.
최대공약수
let getGCD = (num1, num2) => {
let gcd = 1;
for(let i=1; i<=Math.max(num1, num2); i++){
if(num1 % i === 0 && num2 % i === 0){
gcd = i;
}
}
return gcd;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment