Do..while loop implementation and first test

This commit is contained in:
Mikhail Glukhikh
2016-09-23 15:04:42 +03:00
committed by Dmitry Petrov
parent bcf2b410ba
commit e03e13af43
4 changed files with 86 additions and 0 deletions
+11
View File
@@ -0,0 +1,11 @@
fun digitCountInNumber(n: Int, m: Int): Int {
var count = 0
var number = n
do {
if (m == number % 10) {
count++
}
number /= 10
} while (number > 0)
return count
}