Task: Printing a Sequence
Task
Swipe to start coding
Write a program that prints the first ten even numbers.
- Create a
forloop with these parameters:- Initialization: start
iat1. - Condition: continue the loop while
i <= 10. - Update: increase
iby1after each iteration.
- Initialization: start
- Inside the loop, use
console.logto print the value ofi * 2. This will display the first ten even numbers (2, 4, 6, …, 20).
Solution
Everything was clear?
Thanks for your feedback!
Section 1. Chapter 68
single
Ask AI
Ask AI
Ask anything or try one of the suggested questions to begin our chat
Awesome!
Completion rate improved to 1.33
Task: Printing a Sequence
Swipe to show menu
Task
Swipe to start coding
Write a program that prints the first ten even numbers.
- Create a
forloop with these parameters:- Initialization: start
iat1. - Condition: continue the loop while
i <= 10. - Update: increase
iby1after each iteration.
- Initialization: start
- Inside the loop, use
console.logto print the value ofi * 2. This will display the first ten even numbers (2, 4, 6, …, 20).
Solution
Everything was clear?
Thanks for your feedback!
Section 1. Chapter 68
single