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

Programming Exercises

Create a Kotlin program to calculate the sum of an array.

Easy

Problem Statement

Create a Kotlin program to calculate the sum of an array.

Sample Input

A hardcoded array, e.g., [1, 2, 3, 4, 5].

Sample Output

The sum of the array is: 15

Limits

Time: 2s · Memory: 256 MB

Code Editor
00:00
fun main() { val numbers = arrayOf(1, 2, 3, 4, 5) // Add your code here to calculate the sum }
Log in or sign up to run or submit your code.Log inSign up
Input
A hardcoded array, e.g., [1, 2, 3, 4, 5].
Expected Output
The sum of the array is: 15