Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.io.*;
- public class Main {
- public static void main(String[] args) throws Exception {
- BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
- int sum = 0;
- while (true) {
- String num1 = reader.readLine();
- int num = Integer.parseInt(num1);
- sum = sum + num;
- if (num == -1) {
- System.out.println(sum);
- break;
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement