Guest User

Untitled

a guest
Aug 23rd, 2020
50
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.51 KB | None | 0 0
  1. public class Main {
  2.     public static void main(String[] args) {
  3.         int sum1 = 0;
  4.         int second;
  5.  
  6.         BufferedReader r = new BufferedReader(new InputStreamReader(System.in));
  7.         try {
  8.             while (true) {
  9.                 String line = r.readLine();
  10.                 if (line.isEmpty())break;
  11.                 second = Integer.parseInt(line);
  12.                 sum1 += second;
  13.             }
  14.  
  15.         } catch (Exception ignored) {
  16.  
  17.         }
  18.  
  19.         System.out.println(sum1);
  20.  
  21.     }
  22. }
Advertisement
Add Comment
Please, Sign In to add comment