Using continue display the odd numbers between 1 to 20.
Answers
Answered by
0
Answer:
1
3
5
7
9
11
13
15
17
19 .......
hope so it will help you
Answered by
0
Code for a continue display is given below .
EXPLANATION:
‘Continue’ will not terminate the loop. It is used to skip the statement following it, if given condition is satisfied. It then executes the loop with next iteration.
function print(){
var i;
var write = document.getElementsByTagName('h1')[0];
for(i = 1; i <= 20; i++){
if((i % 2) == 0){
continue; //if number is odd, it will skip it.
}
write.innerHTML += i + '<br/>';
}
}
print();
Similar questions
Social Sciences,
5 months ago
English,
5 months ago
Math,
5 months ago
Computer Science,
10 months ago
Computer Science,
10 months ago
Hindi,
1 year ago