Floating-point to integer conversion

Report a typo

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.

Sample Input 1:

3.14

Sample Output 1:

3

Sample Input 2:

-2.71

Sample Output 2:

-2
Write 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