Добавьте бесконечные числа в переменную Java
Scanner sc = new Scanner(System.in);
int value = 0;
int total = 0;
//adds a number to the total variable every occurence of the loop
for (;;) {
System.out.println("Enter a number");
value = sc.nextInt();
total += value;
System.out.println("You added " + value + " to the total");
System.out.println("The total is " + total + " so far");
value = 0;
}
Chase_Exists