Write a program that reads a floating-point number from the user, converts it to an integer, and prints the result. The program should handle both positive and negative numbers.
Type conversion
Floating-point to integer conversion
Report a typo
Sample Input 1:
3.14Sample Output 1:
3Sample Input 2:
-2.71Sample Output 2:
-2Write a program in Kotlin
fun main() {
// read a floating-point number
val floatNumber = readln().toDouble()
// TODO: Convert the floating-point number to an integer
// TODO: Print the converted integer
}
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.