Created
January 14, 2015 03:52
-
-
Save jessedhillon/e40ca83e29a04b311e19 to your computer and use it in GitHub Desktop.
Printing squares in a loop
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
// 1. Prompt user for a number, n | |
// 2. Print the square of every number between 0 and n | |
var number = parseInt(prompt("Give me a number")); // prompt is a built-in function | |
for(var i = 0; i <= number; i++) { | |
console.log(i * i); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment