Skip to content

Instantly share code, notes, and snippets.

@macikokoro
Last active August 29, 2015 14:02
Show Gist options
  • Save macikokoro/402403ea66427ae91707 to your computer and use it in GitHub Desktop.
Save macikokoro/402403ea66427ae91707 to your computer and use it in GitHub Desktop.
For loop to print squares of odd numbers between 100 and 150 and ignore even numbers.
<script>
for (var i = 100; i <=150; i++) {
if (i % 2 == 1) {
console.log (i * i);
}
else {
console.log (i);
}
}
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment