Created
December 29, 2015 04:23
-
-
Save anonymous/ff10799c503292b7a756 to your computer and use it in GitHub Desktop.
https://repl.it/BarQ/1 created by Gereltuya
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var totthree=0; | |
var totfive=0; | |
var a = 3983; | |
var dtotal=0; | |
for (var b=3; b<990; b++) { | |
if (b%3===0) { | |
totthree=totthree+b; | |
} | |
} | |
for (var c=5; c<990; c++) { | |
if (c%5===0) { | |
totfive=totfive+c; | |
} | |
} | |
for (var d=15; d<990; d++) | |
{ if (d%15===0) { | |
dtotal=dtotal+d; | |
} | |
} | |
console.log((a+totthree+totfive)-dtotal); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Native Browser JavaScript | |
>>> 232178 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
in this example, the problem were solved only contemplating till 990 and the rest were added manually (993; 995, 996, 999) and the result is 3983. In this example it is ( var a =3983).
The total of the loops results came out to be 232178.