Advertisement
Yashov

Untitled

Mar 9th, 2020
167
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.47 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. import static java.lang.System.in;
  4.  
  5. public class SumNumbers {
  6. public static void main(String[] args) {
  7. Scanner scanner = new Scanner(in);
  8. int sum = 0;
  9. String input = scanner.nextLine();
  10. while (!input.equals("Stop")) {
  11. int number = Integer.parseInt(scanner.nextLine());
  12. sum += number;
  13. input = scanner.nextLine();
  14. }
  15. System.out.println(sum);
  16. }
  17. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement