Print the square of a given number

Report a typo

You are given a number 'n'. Write a Kotlin program to print the square of this number 'n'. Your function should scan a number 'n' as input and as output it should print the square of 'n'.

Sample Input 1:

4

Sample Output 1:

16

Sample Input 2:

10

Sample Output 2:

100
Write a program in Kotlin
// Necessary imports
import java.util.Scanner

fun main(args: Array<String>) {
// Your code here: Create a Scanner object to read the input
val scanner = Scanner(System.`in`)

// Your code here: Read an integer using the Scanner object
val n = scanner.nextInt()

// Your code here: Calculate and print the square of n
}

Create a free account to access the full topic