fork download
  1. fun printDivisors(n: Int) {
  2. for (i in 1 until n + 1) {
  3. if (n % i == 0) {
  4. println(i)
  5. }
  6. }
  7. }
  8.  
  9. fun main() {
  10. val n = 12
  11.  
  12. println("Dzielniki liczby %n:")
  13. printDivisors(n)
  14. }
Success #stdin #stdout 0.09s 40828KB
stdin
Standard input is empty
stdout
Dzielniki liczby %n:
1
2
3
4
6
12