Computer Applications
Convert the following for loop statement into the corresponding while loop and do-while loop:
int sum = 0;
for (int i = 0; i <= 50; i++)
sum = sum + i;
Related Questions
How many times are the following loop bodies repeated? What is the final output in each case?
int x = 2; while (x < 20) if (x % 2 == 0) System.out.println(x);
What is an empty statement? Explain its usefulness.
Identify all the errors in the following repetitive statements.
while (x == y) { xx = yy; x = y; }
What are the differences between while loop and do-while loop?