I am trying to Write a “query-controlled” loop that will continue to input int values from the user, adding each to the int value sum, and then ask if the user has another value to input, until the user says that there are no more values. Assume that the scanner class has been imported.
Do you think this is right
int total =0,val=0;
scanner sc = new scanner();
System.out.println(“Enter a value (enter 0 to quit) :”);
val = sc.intValue();