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

Programming Exercises

Write a function to find all numbers in an array that are divisible by a given number.

Hard

Problem Statement

Write a function to find all numbers in an array that are divisible by a given number.

Sample Input

Hardcoded array [10, 15, 20, 25, 30] and divisor 5.

Sample Output

Numbers divisible by 5: [10, 15, 20, 25, 30]

Limits

Time: 2s · Memory: 256 MB

Code Editor
00:00
fun findDivisibleNumbers(nums: Array<Int>, divisor: Int): List<Int> { // Add your code here to find divisible numbers } fun main() { val nums = arrayOf(10, 15, 20, 25, 30) val divisor = 5 println("Numbers divisible by $divisor: ${findDivisibleNumbers(nums, divisor)}") }
Log in or sign up to run or submit your code.Log inSign up
Input
Hardcoded array [10, 15, 20, 25, 30] and divisor 5.
Expected Output
Numbers divisible by 5: [10, 15, 20, 25, 30]