package _08_while;

import java.util.Scanner;

public class Test6 {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        System.out.println("请输入数字(如果为0结束)");
        int next = scanner.nextInt();
        // 定义总和
        int sum = 0;
        while (next !=0){
            sum += next;
            System.out.println("当前累积和为:" + sum);
            next = scanner.nextInt();
        }
        System.out.println("最总总和为:"+ sum);
    }
}
