Simplified the solution for 'Summary 1 ex 8'
as suggested in https://github.com/BruceEckel/AtomicKotlinExamples/issues/19
This commit is contained in:
parent
1a891f4a41
commit
96e21f6122
|
@ -6,11 +6,9 @@ fun reverseDecimal(number: Int): Int {
|
||||||
var result = 0
|
var result = 0
|
||||||
|
|
||||||
while (worker > 0) {
|
while (worker > 0) {
|
||||||
|
result *= 10
|
||||||
result += worker % 10
|
result += worker % 10
|
||||||
worker /= 10
|
worker /= 10
|
||||||
if (worker != 0) {
|
|
||||||
result *= 10
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return result
|
return result
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,7 +4,7 @@ files:
|
||||||
visible: true
|
visible: true
|
||||||
placeholders:
|
placeholders:
|
||||||
- offset: 89
|
- offset: 89
|
||||||
length: 171
|
length: 140
|
||||||
placeholder_text: TODO()
|
placeholder_text: TODO()
|
||||||
- name: test/Tests.kt
|
- name: test/Tests.kt
|
||||||
visible: false
|
visible: false
|
||||||
|
|
Loading…
Reference in New Issue