Skip to content

Instantly share code, notes, and snippets.

@amolpednekar
Created December 1, 2017 15:41
Show Gist options
  • Save amolpednekar/561e098d03b0477486193f7b119d6e47 to your computer and use it in GitHub Desktop.
Save amolpednekar/561e098d03b0477486193f7b119d6e47 to your computer and use it in GitHub Desktop.
Vacation labs angular-workshop entry code
/* Write a program in JS that prints numbers 1 to 100. For every multiple of 3, print "Earth".
For every multiple of 5, print "Jupiter". For every multiple of 9, print "Pluto".
Create a Github repo, and save this JS file in it. Paste the URL of the repo here. */
for (let i = 1; i <= 100; i++) {
let output = "";
if (i % 3 === 0) {
output += "Earth "
}
if (i % 5 === 0) {
output += "Jupiter "
}
if (i % 9 === 0) {
output += "Pluto "
}
if (output === "") {
output = i;
}
console.log(output);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment