Do..while loop implementation and first test
This commit is contained in:
committed by
Dmitry Petrov
parent
bcf2b410ba
commit
e03e13af43
+11
@@ -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
|
||||
}
|
||||
Reference in New Issue
Block a user