Computer Science: An Overview: Global Edition (12th Edition)

Published by Pearson Higher Education
ISBN 10: 1292061162
ISBN 13: 978-1-29206-116-0

Chapter 6 - Programming Languages - Chapter Review Problems - Page 325: 21

Answer

i=0 while ( i<100) { $\space \space \space \space$if (i % 2 == 0) { $\space \space \space \space$$\space \space \space \space$print(i); $\space \space \space \space$} $\space \space \space \space$i++; }

Work Step by Step

i=0 while ( i<100) { $\space \space \space \space$if (i % 2 == 0) { $\space \space \space \space$$\space \space \space \space$print(i); $\space \space \space \space$} $\space \space \space \space$i++; } In the above while loop the loop variable i goes from 0 to 99 and the value of i is printed when i is even, which is same as the for loop given in the question.
Update this answer!

You can help us out by revising, improving and updating this answer.

Update this answer

After you claim an answer you’ll have 24 hours to send in a draft. An editor will review the submission and either publish your submission or provide feedback.