import java.util.Scanner;
public class Tally {
public static void main(String[] args) {
Scanner keyboard = new Scanner(System.in);
int input;
int sum = 0;
input = keyboard.nextInt();
while (input >= 0) {
sum += input;
input = keyboard.nextInt();
}
System.out.println(sum);
keyboard.close();
}
}
import java.util.Random;
import java.util.Scanner;
class GuessingGame {
public static void main(String[] args) {
Scanner keyboard = new Scanner(System.in);
Random myRandom = new Random();
int randomNumber;
int guess;
randomNumber = myRandom.nextInt(10) + 1;
System.out.print("Guess a number from 1 to 10: ");
guess = keyboard.nextInt();
while (guess != randomNumber) {
System.out.print("Guess a number from 1 to 10: ");
guess = keyboard.nextInt();
}
keyboard.close();
}
}