Answer the question
In order to leave comments, you need to log in
How to output such a sequence using nested loops for any number of iterations of the outer loop?
With the help of nested loops, draw a string:
10x01x
10x01x
10x01x
For example, the symbol "x" - is displayed every third iteration of the loop, how to write it?
Answer the question
In order to leave comments, you need to log in
output every third iteration of the loop, how to write this?
%
for (let i = 0; i < 5; i++) {
for (let j = 0; j < 10; j++) {
if (j % 3 === 0) {
console.log("Это 0, 3, 6, 9, ... итерация внутреннего цикла");
}
if (j % 3 === 2) {
console.log("Это 2, 5, 8, ... итерация внутреннего цикла");
}
}
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question