fun gcd(num1: Int, num2: Int): Int {
var a = num1
var b = num2
while (b != 0) {
val b2 = b
b = a % b
a = b2
}
return a
}
fun main() {
val a = 32
val b = 12
val result = gcd(a, b)
println("GCD($a, $b) = $result")
}
ZnVuIGdjZChudW0xOiBJbnQsIG51bTI6IEludCk6IEludCB7CiAgdmFyIGEgPSBudW0xCiAgdmFyIGIgPSBudW0yCgogIHdoaWxlIChiICE9IDApIHsKICAgIHZhbCBiMiA9IGIKICAgIGIgPSBhICUgYgogICAgYSA9IGIyCiAgfQoKICByZXR1cm4gYQp9CgpmdW4gbWFpbigpIHsKICB2YWwgYSA9IDMyCiAgdmFsIGIgPSAxMgoKICB2YWwgcmVzdWx0ID0gZ2NkKGEsIGIpCgogIHByaW50bG4oIkdDRCgkYSwgJGIpID0gJHJlc3VsdCIpCn0=