#14 – L3 Write the code that uses the integer variables sum…
#14 – L3 Write the code that uses the integer variables sum and userInput to accomplish the following tasks: 1. Create a do-while loop that continues until userInput is 0. 2. Inside the do-while loop, prompt the user to enter a number and store it in userInput. 3. Check if the entered number is divisible by 3. If it is, add that number to the sum variable. The number can be either positive or negative. 4. After the loop finishes, print a message that displays the value of the sum variable. Given the code: int sum = 0;int userInput;Scanner sc = new Scanner(System.in);//Write your code here:
Read Details