Multiples of 3 and 5

Finds the sum of all the multiples of 3 or 5 below the entered numeric value and lists all the multiples. Based on Project Euler problem number 1 (https://projecteuler.net/problem=1).

by Uzair Mehmood

HTML

<label for="input">Count sum upto :</label>
<input type="text" id="input" />
<hr>
<p id="output"></p>

CSS

#output{
  word-break: break-all;
}

JavaScript

$("#input").change(function () {

    var numbers = [];
    var total = 0;
    for (var i = 1; i < $(this).val(); i++) {
        if (i % 3 === 0 || i % 5 === 0) {
            numbers.push(i);
            total += i;
        }
    }

    $("#output").html("Sum of numbers : " + total.toString() + "<br />Numbers : " + numbers);
});