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

Programming Exercises

Create a program to sort an array of integers in descending order.

Medium

Problem Statement

Create a program to sort an array of integers in descending order.

Sample Input

A hardcoded array: [5, 2, 8, 1, 3]

Sample Output

Sorted array in descending order: 8, 5, 3, 2, 1

Limits

Time: 2s · Memory: 256 MB

Code Editor
00:00
fun main() { val numbers = arrayOf(5, 2, 8, 1, 3) // Add your code here to sort the array in descending order }
Log in or sign up to run or submit your code.Log inSign up
Input
A hardcoded array: [5, 2, 8, 1, 3]
Expected Output
Sorted array in descending order: 8, 5, 3, 2, 1