In any programming language, input-output is important to interact with the user. In Kotlin, we use Scanner for input and println/print for output.
Here, we are implementing a Kotlin program to input various types of numbers and printing them on screen.
Program to input and print numbers in Kotlin
Output
In the above program, we are taking input of the numbers (integer, long, float and double) using methods of Scanner class. nextInt() is used for Integer value input, nextLong() for Long value input, nextFloat() for Float value input, and nextDouble() for Double value input.
need an explanation for this answer? contact us directly to get an explanation for this answer