Question: Code the following while loop as a for loop: int x =1 , sum =0; while (x
Code the following while loop as a for loop: int x =1 , sum =0; while (x<=4) { sum = sum +x; x++; } System.out.println("Sum is: " + sum);
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
