Practice Real Company Assessment Patterns • Latest 2025–2026 Mock Tests

Programming Exercises

Find the square of a number

Easy

Problem Statement

Find the square of a number

Sample Input

4

Sample Output

The square of 4 is: 16

Limits

Time: 2s · Memory: 256 MB

Code Editor
00:00
fun square(n: Int): Int { // Add your code here to calculate the square } fun main() { val number = 4 println("The square of $number is: ${square(number)}") }
Log in or sign up to run or submit your code.Log inSign up
Input
4
Expected Output
The square of 4 is: 16