import java.util.Scanner; public class AddingLoop { public static void main( String[] args ) { Scanner keyboard = new Scanner(System.in); int input, total; input = 1; total = 0; System.out.println("I will add up te numbers you give me."); while (input != 0) { System.out.print("Number: "); input = keyboard.nextInt(); total = total + input; if (input != 0) System.out.println("The total so far is " +total+ "."); } System.out.println("\nThe total is " +total+ "."); } }