-
Code const isDivisible = (n, x, y) => n % x + n % y === 0
Test Cases const chai = require("chai"); const assert = chai.assert; chai.config.truncateThreshold=0; describe("Basic tests", () => { it("Fixed Tests", () => { assert.strictEqual(isDivisible(3,3,4),false); assert.strictEqual(isDivisible(12,3,4),true); assert.strictEqual(isDivisible(8,3,4),false); assert.strictEqual(isDivisible(48,3,4),true); }); });
Output:
-
Code const isDivisible = (n, x, y) => {if (n % x == 0 && n % y == 0) return trueelse return false}- const isDivisible = (n, x, y) => n % x + n % y === 0
- All
- {{group.name}} ({{group.count}})
This comment has been reported as {{ abuseKindText }}.
Show
This comment has been hidden. You can view it now .
This comment can not be viewed.
- |
- Reply
- Edit
- View Solution
- Expand 1 Reply Expand {{ comments?.length }} replies
- Collapse
- Remove
- Remove comment & replies
- Report
{{ fetchSolutionsError }}