Loop Rewriting
Rewrite the following for statements as while statements.
a. for (int i = 0, sum = 0; i<10; i++)
sum = sum + i * i;
b. int sum;
for (int i = 0; i<10; i + +)
{
sum = 0;
for (int j = 0; j < = i; j++)
sum = sum + j;
System.out.println(sum);
}
c. int i, sum;
for (i = 0, sum = 0; i<10; sum += i++);
System.out.println(sum);
We need at least 10 more requests to produce the solution.
0 / 10 have requested this problem solution
The more requests, the faster the answer.