[Solved] Exercise 4 Program Counts Adds Sum First 99 Positives Integers Public Class Mystery Public Q37196667
Exercise #4: This program counts and adds up the sum of the first 99 positives integers. public class Mystery public static void main (String[1 args) line1 int counter, sum; declare loop counter and sum initialize the loop counter initialize the sum 4 iterate the loop 99 times counter = 1; // line 2 sum0 / 1ine 3 while counter <100) // line sum = sum + counter; line 5 add value of counter to the sum 1; // 1ine counter=counter + 6 increment the counter System.out.printf(“The sum is %dn ” sum a) Delete line 2 and run your program. Explain what you b) Go back to the original program and delete line 6. Then c Go back to the original program and change line 2 to run your program and Explain what do you notice. 100. Then run your program and explain what counter you notice. d) Go back to the original program and exchange line 5 and line 6, then run the program and explain what you notice. Show transcribed image text Exercise #4: This program counts and adds up the sum of the first 99 positives integers. public class Mystery public static void main (String[1 args) line1 int counter, sum; declare loop counter and sum initialize the loop counter initialize the sum 4 iterate the loop 99 times counter = 1; // line 2 sum0 / 1ine 3 while counter
Expert Answer
Answer to Exercise #4: This program counts and adds up the sum of the first 99 positives integers. public class Mystery public sta… . . .
OR

