Write a program that, given an integer, sums all the numbers from 1 through that integer (both inclusive). Do not include in your sum any of the intermediate numbers (1 and n inclusive) that are divisible by 5 or 7.

Relax

Respuesta :

tonb

Answer:

let n = 10;

let sum = 0;

for(i=1; i<=n; i++) {

if ((i%5) && (i%7)) {

 sum += i;

}

}

console.log(`Sum 1..${n} excluding 5 and 7 multiples is ${sum}`);

Explanation:

This is in javascript.

example output:

Sum 1..10 excluding 5 and 7 multiples is 33