Write the following code using do...while loop:
for (var i = 1; i <= 100; i = i + 2)
document.write (i + "<br>");
Answers
Answered by
5
Question:-
- Write the code using do while loop.
Answer:-
Given code (in JavaScript)
for (var i = 1; i <= 100; i = i + 2)
document.write (i + "<br>");
Using do while loop, we can write like this,
var i=1;
do
{
document.write (i + "<br>");
i=i+2;
} while(i<=100);
Similar questions