Skip to content

Instantly share code, notes, and snippets.

@ohmygodwin
Created May 8, 2013 15:30
Show Gist options
  • Save ohmygodwin/5541255 to your computer and use it in GitHub Desktop.
Save ohmygodwin/5541255 to your computer and use it in GitHub Desktop.
Project Euler Problem 1
/**
* Project Euler Problem 1
*/
h1 {
padding: 50px;
font:30px helvetica,sans-serif;
}
<h1>Total:</h1>
<p id="number"></p>
function add() {
var n = 0,
count = 0;
while (n < 1000) {
if (n % 3 == 0 || n % 5 == 0) {
count = count + n;
}
n++;
}
return count;
}
document.getElementById('number').innerHTML = add();
{"view":"split-vertical","fontsize":"100","seethrough":"","prefixfree":"1","page":"javascript"}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment