Challenge 4: Check If a Number Is Divisible by Another

In this challenge, you are required to check if a number x is divisible by a number y.

Problem Statement

Implement a function named isDivisible that receives two parameters (named x and y) and only returns true if “x” can be divided by “y”(and false otherwise).

A number is divisible by another when the remainder of the division is zero. Use the modulo operator ("%").


Two numbers x and y


Returns true if x is divisible by y and false otherwise

Sample Input

x = 4, y = 2

Sample Output


Coding Exercise

Write your code below. It is recommended​ that you try solving the exercise yourself before viewing the solution.

Get hands-on with 1000+ tech skills courses.