Skip to content

Instantly share code, notes, and snippets.

@trys
Created April 8, 2015 16:10
Show Gist options
  • Save trys/61c004321c9945286e41 to your computer and use it in GitHub Desktop.
Save trys/61c004321c9945286e41 to your computer and use it in GitHub Desktop.
Problem Five
var test = 20,
largest = 1,
divisibleFlag;
for ( var t = 20; t > 0; t-- ) {
largest = largest * t;
}
for ( var i = 20; i <= largest; i += 20 ) {
divisibleFlag = false;
for ( var j = 20; j > 1; j-- ) {
if ( i % j !== 0 ) {
divisibleFlag = false;
break;
}
divisibleFlag = true;
}
if ( divisibleFlag ) {
document.write( i );
break;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment