The following main method is supposed to print the sum of the numbers 1 through 5 and the product of the numbers 1 through 5. Find all the bugs in the program and fix them. Do not add or delete statements. Just fix existing statements. We encourage you to check your work by running test code on a computer.
public static void main(String[] args) {int count = 0;int sum = 0;int product = 0;do{count++;sum += count;product *= count;if (count == 5)System.out.println("Sum = " + sum);System.out.println("Product = " + product);} while (count<5)} // end mainIntended output:
Sum = 15Product = 120
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.