Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

(a) [2 points] What is printed by the following program with a while-loop? Assum

ID: 3614434 • Letter: #

Question

(a) [2 points] What is printed by the following program with a
while-loop? Assume that i and j have been declared asintegers.
(b) [4 points] Change the while-loop to a for-loop and rewrite the
program-fragment.

i = 10;
while ( i >= 1 )
   { j = i*i;
     System.out.println(" " + i + " " + j);
     i = i - 2;
   }
System.out.println("End of program");

Explanation / Answer

please rate - thanks (a) [2 points] What is printed by the following program with a while-loop? Assume that i and j have been declared asintegers. (b) [4 points] Change the while-loop to a for-loop and rewrite the program-fragment. i = 10; while ( i >= 1 )    { j = i*i;      System.out.println(" " + i + " " + j);      i = i - 2;    } System.out.println("End of program");     trace      i     j    10      100    8         64    6         36    4         16    2          4     0 output-answer to your question part a 10 100 8 64 6 36 4 16 2 4 End of program as a for loop-code for part b import java.util.*;   public class untitled2 {public static void main(String[] args) {int i,j; for(i=10;i>=1;i-=2)    { j = i*i;      System.out.println(" " + i + " " + j);    } System.out.println("End of program"); } }