Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.io.BufferedReader;
- import java.io.IOException;
- import java.io.InputStreamReader;
- public class Main {
- public static void main(String[] args) throws IOException {
- BufferedReader read = new BufferedReader(new InputStreamReader(System.in));
- int x = 0;
- int i = 0;
- while(i != 40){
- try {
- int a = Integer.parseInt(read.readLine());
- x += a;
- i++;
- }
- catch (NumberFormatException exp){
- System.out.println("Должно быть введено число");
- }
- }
- System.out.println(x);
- read.close();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement