Files
prog-Kazakov/Kotlin/lab-04/Readme.md
T
2026-09-28 09:56:22 +03:00

33 lines
970 B
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
## task 1
```kotlin
var deckSize = 60
var cardsInHand = 0
println("Введите кол-во карт: ")
var targetDrawInput = readln().toInt()
while (cardsInHand < targetDrawInput && deckSize > 0){
cardsInHand++
deckSize--
}
println("[ДОБОР] Взята карта №$targetDrawInput В руке: $cardsInHand карт, в колоде осталось: $deckSize")
```
## task 2
```kotlin
var energyCost = -1
while(energyCost < 0) {
print("Введите кол-во энергии: ")
energyCost = readln().toInt()
if (energyCost < 0) {
println("[ОШИБКА] Стоимость атаки не может быть отрицательной! Попробуйте снова.")
} else if (energyCost >= 0) {
println("[УСПЕХ] Корректная стоимость атаки принята: ...")
}
}
```
## task 3
```kotlin
```