function divisibleSumPairs(n, k, ar) { // This code calculates the sum of all the positive integers that are evenly divisible by k. // It checks to see if the number is evenly divisible by k by testing if the integer at // position i is evenly divisible by k + 1. If it is, the function increments i and continues to // the next position. If not, the function checks to see if the number at position i is evenly divisible // by k β 1. If it is, the function increments i and continues to the next position. If not, the // function checks to see if the number at position i is evenly divisible by 2k. If it is, the function increments // i and continues to the next position. If not, the function returns the value at position i. //
function divisibleSumPairs(n, k, ar) { // This code calculates the sum of all the positive integers that are evenly divisible by k. // It checks to see if the number is evenly divisible by k by testing if the integer at // position i is evenly
function divisibleSumPairs(n, k, ar) {
// Write your code here
let intCounter = 0;
let isDivider = 0;
for (let i = 0; i < n; i++) {
for (let j = i + 1; j < n ; j++) {
isDivider += ar[i] + ar[j];
if (isDivider !== 0) {
intCounter = isDivider % k === 0 ? (intCounter += 1) : intCounter;
isDivider = 0;
}
}
}
return intCounter
}