Last digit of the square of a number
Kotlin
Easy
functions
Task «Last digit of the square of a number»
Write a function `lastDigitOfSquare(n: Int): Int` that takes a non-negative integer `n` and returns the last digit of the number n^2 (the square of the number). Implement this function and test it in `main`, reading one integer from standard input and outputting the result.
Input Format
One non-negative integer n (0 ≤ n ≤ 10^9).
Output Format
An integer — the last digit of the square of n.
Examples
Example 1
INPUT
5
OUTPUT
5
Example 2
INPUT
7
OUTPUT
9
main.kt