Hey there! This problem might be a bit unpredictable, but give it a go and let us know how you do!
Create a program that prints a countdown from a given number to 1 using a while loop. The program should take a single positive integer as input and print each number in the countdown on a separate line.While loops
Descending digits dance
Report a typo
Sample Input 1:
5Sample Output 1:
5
4
3
2
1Sample Input 2:
3Sample Output 2:
3
2
1Write a program in Kotlin
import java.util.Scanner
fun main() {
val scanner = Scanner(System.`in`)
val number = scanner.nextInt()
// Implement the countdown using a while loop
}
Create a free account to access the full topic
By continuing, you agree to the JetBrains Academy Terms of Service as well as Hyperskill Terms of Service and Privacy Policy.