Answer:
Here's the modified code that reads integers from input until the integer 10 is read and then finds the sum of all integers read, excluding 10:
Step-by-step explanation:
import java.util.Scanner;
public class SumCalculator {
public static void main(String[] args) {
Scanner scnr = new Scanner(System.in);
int userIn;
int result = 0;
userIn = scnr.nextInt();
while (userIn != 10) {
result += userIn;
userIn = scnr.nextInt();
}
System.out.println(result);
}
}