programming-examples/js/Conditional/Write a JavaScript program to sum the multiples of 3 and 5 under 1000..js
2019-11-15 12:59:38 +01:00

9 lines
156 B
JavaScript

var sum = 0;
for (var x = 0; x < 1000; x++)
{
if (x % 3 === 0 || x % 5 === 0)
{
sum += x;
}
}
console.log(sum);