Skip to content

Instantly share code, notes, and snippets.

@ram0973
Last active March 11, 2021 16:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ram0973/6c448f0777b267a2b1ace372f2eb497a to your computer and use it in GitHub Desktop.
Save ram0973/6c448f0777b267a2b1ace372f2eb497a to your computer and use it in GitHub Desktop.
Test sum
package com.javarush.task.task04.task0442;
import java.io.BufferedReader;
import java.io.InputStreamReader;
public class Solution {
public static void main(String[] args) throws Exception {
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
int sum = 0;
int number = 0;
while (number != -1) {
number = Integer.parseInt(reader.readLine());
sum = sum + number;
}
System.out.println(sum);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment