diff --git a/MultiOfThreeAndFive.js b/MultiOfThreeAndFive.js new file mode 100644 index 0000000..4370051 --- /dev/null +++ b/MultiOfThreeAndFive.js @@ -0,0 +1,12 @@ +function MultipleOfInt(){ +//Find the sum of all the multiples of 3 or 5 below 1000. +var no=Number(document.getElementById("numMul").value); +var sum = 0; +for (var i = 0; i < no; i++) { + if (i % 3 === 0 || i % 5 === 0) { + sum += i; + } +} +document.getElementById("mulSet").value= sum; +console.log('Sum: %d', sum); +} \ No newline at end of file diff --git a/MultipleBuzFiz.js b/MultipleBuzFiz.js new file mode 100644 index 0000000..47db42c --- /dev/null +++ b/MultipleBuzFiz.js @@ -0,0 +1,17 @@ +function multiplesFizBuz(){ +var sum; +var no=Number(document.getElementById("numMul").value); +for (var x=1; x <= no; x++){ + if( x % 3 && x % 5 ) { + console.log(x); + } else { + if( x % 3 == 0 ) { + console.log("buzz"); + } + if( x % 5 == 0 ) { + console.log("fizz"); + } + } + +} +} \ No newline at end of file diff --git a/MultiplethreeBuz.html b/MultiplethreeBuz.html new file mode 100644 index 0000000..26d1d8f --- /dev/null +++ b/MultiplethreeBuz.html @@ -0,0 +1,19 @@ + + + +
+