JAVA: Replace the for loop below with a code using the "While" loop: int s = 0; int c = 0; boolean valid = true; for(int i = 4; i 20) { valid = false; } } System.out.println(s / c);


JAVA:


Replace the for loop below with a code using the "While" loop:


int s = 0;


int c = 0;


boolean valid = true;


for(int i = 4; i <= 20="" ||="" valid;="" i="i+2)">


     if(i%4 != 0) {


          s = s + i;


          c++;


     }


     if(i > 20) {


          valid = false;


     }


}


System.out.println(s / c);



Jun 06, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here