Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- import static java.lang.System.in;
- public class SumNumbers {
- public static void main(String[] args) {
- Scanner scanner = new Scanner(in);
- int sum = 0;
- String input = scanner.nextLine();
- while (!input.equals("Stop")) {
- int number = Integer.parseInt(scanner.nextLine());
- sum += number;
- input = scanner.nextLine();
- }
- System.out.println(sum);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement