Skip to content

Commit

Permalink
fix russian Kotlin-Polytech#2
Browse files Browse the repository at this point in the history
  • Loading branch information
vladdenisov committed Sep 15, 2021
1 parent d2b3662 commit dbbd82f
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/lesson4/task1/List.kt
Original file line number Diff line number Diff line change
Expand Up @@ -352,12 +352,15 @@ fun russian(n: Int): String {
triadResult += " две тысячи "
} else if (triad[1].digitToIntOrNull()!! in 5..9) {
triadResult += firstDecade[triad[1].digitToIntOrNull()!!] + " тысяч "
} else if (triad[1] == '0') {
triadResult += " тысяч "
} else {
triadResult += firstDecade[triad[1].digitToIntOrNull()!!] + " тысячи "
}
triadResult += when (triad[1]) {
'0' -> " тысяч "
'1' -> "одна тысяча "
'2' -> " две тысячи "
else -> firstDecade[triad[1].digitToIntOrNull()!!] + " тысячи "

}
}
} else {
if (triad[1] == '0' && triad[2] == '0') {
triadResult += hundreds[triad[0].digitToIntOrNull()!!] + " тысяч "
Expand Down

0 comments on commit dbbd82f

Please sign in to comment.