Last active
August 29, 2015 14:03
-
-
Save macikokoro/f07a98bd7c775bcc214e to your computer and use it in GitHub Desktop.
While loop with multiplication.
This file contains hidden or 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
var numSheep = 4; | |
var monthNumber = 1; | |
var monthsToPrint = 12; | |
while(monthNumber <= monthsToPrint) { | |
numSheep *= 4; | |
console.log("There will be " + numSheep + " sheep after " + monthNumber + " month(s)!"); | |
monthNumber++; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This while loop will print = There will be (number of sheep) sheep after 1 month(s)!