fun printDivisors(n: Int) {
for (i in
1 until
sqrt(n.
toDouble()).
toInt() + 1) { if (n % i == 0) {
println(i)
if (i != n / i) {
println(n / i)
}
}
}
}
fun main() {
val n = 12
println("Dzielniki liczby $n:")
printDivisors(n)
}
aW1wb3J0IGtvdGxpbi5tYXRoLnNxcnQKCgpmdW4gcHJpbnREaXZpc29ycyhuOiBJbnQpIHsKICBmb3IgKGkgaW4gMSB1bnRpbCBzcXJ0KG4udG9Eb3VibGUoKSkudG9JbnQoKSArIDEpIHsKICAgIGlmIChuICUgaSA9PSAwKSB7CiAgICAgIHByaW50bG4oaSkKCiAgICAgIGlmIChpICE9IG4gLyBpKSB7CiAgICAgICAgcHJpbnRsbihuIC8gaSkKICAgICAgfQogICAgfQogIH0KfQoKZnVuIG1haW4oKSB7CiAgdmFsIG4gPSAxMgoKICBwcmludGxuKCJEemllbG5pa2kgbGljemJ5ICRuOiIpCiAgcHJpbnREaXZpc29ycyhuKQp9