package _08_while;

import java.util.Scanner;

public class InputSumAccumulator {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        // 定义一个总和
        int sum = 0;

        System.out.println("请输入数字(如果为0结束)");
        int input = scanner.nextInt();
        while (input !=0){
            // 拿输入内容不断进行叠加
            sum += input;
            System.out.println("当前累积的和为:"+ sum);
            input = scanner.nextInt();
        }
        System.out.println("流程结束 最终和为:"+ sum);
    }
}