Break / continue implementation, test with break / continue, related changes in loop & loop tests

This commit is contained in:
Mikhail Glukhikh
2016-09-23 15:24:38 +03:00
committed by Dmitry Petrov
parent e03e13af43
commit 5a04c72e75
6 changed files with 135 additions and 6 deletions
+9
View File
@@ -0,0 +1,9 @@
fun isPerfect(n: Int): Boolean {
var sum = 1
for (m in 2..n/2) {
if (n % m > 0) continue
sum += m
if (sum > n) break
}
return sum == n
}