Question: Predict the output sequences that would be produced by each of the following while loops: count = 10; while (count > 0) { document.getElementById('outputDiv').innerHTML =

Predict the output sequences that would be produced by each of the following while loops:

count = 10;

while (count > 0) {

document.getElementById('outputDiv').innerHTML =

document.getElementById('outputDiv').innerHTML + count + '
';

count = count - 2;

}

document.getElementById('outputDiv').innerHTML =

document.getElementById('outputDiv').innerHTML + 'DONE WITH 1ST!
';

num = 1;

while (num <= 5) {

document.getElementById('outputDiv').innerHTML =

document.getElementById('outputDiv').innerHTML + num + '
';

num = num + 1;

}

document.getElementById('outputDiv').innerHTML =

document.getElementById('outputDiv').innerHTML + 'DONE WITH 2ND!
';

x = 1;

y = 10;

while (x < y) {

document.getElementById('outputDiv').innerHTML =

document.getElementById('outputDiv').innerHTML + x + ' ' + y + '
';

x = x + 1;

y = y - 2;

}

document.getElementById('outputDiv').innerHTML =

document.getElementById('outputDiv').innerHTML + 'DONE WITH 3RD!
';

Step by Step Solution

3.52 Rating (159 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

10 8 6 4 2 DONE ... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Document Format (1 attachment)

Word file Icon

1409-C-S-O-S(1086).docx

120 KBs Word File

Students Have Also Explored These Related Operating System Questions!