Last active
May 26, 2021 17:50
-
-
Save appoll/7e4d6fd6422ede5146c527b0de43aeba to your computer and use it in GitHub Desktop.
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
console.log("before the loop"); | |
// I want to print all integer numbers from 0 to 50; | |
// for (i = 0; i <= 50; i++){ | |
for (i = 0; i <= 50; i = i+1){ | |
console.log(i); | |
if (i===10){ | |
console.log("bingo!"); | |
} | |
} | |
console.log("after the loop"); | |
// E1. Print all even numbers between 10 and 20 (including 10 and 100). An even number is a number | |
// x for which the following is true: x % 2 === 0 | |
// E2. Iterate from 0 to 50; Print "##" for even numbers and "!!" for odd numbers; | |
// E3. Print all numbers from 10 to 0 in descending order; | |
// E4. Calculate and print the sum of all even numbers in the interval 0, 100. | |
// E5. Make the code below work. | |
// readline-sync | |
inputFromUser = console.readInputFromUser(); | |
while(isNaN(inputFromUser)){ | |
console.log("This is not a number. Try again"); | |
inputFromUser = console.readInputFromUser(); | |
} | |
console.log("Thanks! You gave me a number!"); | |
console.log(inputFromUser); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment