web-tech/tasks/math-funcs/funcs/gcd.js
2025-11-23 14:00:44 +03:00

8 lines
No EOL
112 B
JavaScript

function gcd(a, b) {
while (b !== 0) {
let temp = b;
b = a % b;
a = temp;
}
return a;
}