Created
December 1, 2017 15:41
-
-
Save amolpednekar/561e098d03b0477486193f7b119d6e47 to your computer and use it in GitHub Desktop.
Vacation labs angular-workshop entry code
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
/* 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