Creating and printing a double value of an integer input

Report a typo

In Kotlin, write a code snippet that takes a single integer as input and creates a read-only (val) variable that equals twice of the input. The program should then print the value of that variable.

Sample Input 1:

2

Sample Output 1:

4

Sample Input 2:

7

Sample Output 2:

14
Write a program in Kotlin
// Start of the program
fun main(args: Array<String>) {
/* The program reads an integer from the input.
* Input a single integer.
*/
val x = readLine()!!.toInt()

// Create a read-only (val) variable that equals twice of the input
// Your code here

// Print the value of the variable
// Your code here
}
// End of the program

Create a free account to access the full topic