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

Programming Exercises

Write a program to find the largest element in an array.

Easy

Problem Statement

Write a program to find the largest element in an array.

Sample Input

A hardcoded array, e.g., [10, 20, 5, 30].

Sample Output

The largest element is: 30

Limits

Time: 2s · Memory: 256 MB

Code Editor
00:00
fun main() { val numbers = arrayOf(10, 20, 5, 30) // Add your code here to find the largest element }
Log in or sign up to run or submit your code.Log inSign up
Input
A hardcoded array, e.g., [10, 20, 5, 30].
Expected Output
The largest element is: 30