SHARE
TWEET

Untitled

a guest Dec 7th, 2019 87 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import java.io.BufferedReader;
  2.         import java.io.IOException;
  3.         import java.io.InputStreamReader;
  4.  
  5. public class Main {
  6.     public static void main(String[] args) throws IOException {
  7.         BufferedReader read = new BufferedReader(new InputStreamReader(System.in));
  8.         int x = 0;
  9.         int i = 0;
  10.         while(i != 40){
  11.             try {
  12.                 int a = Integer.parseInt(read.readLine());
  13.                 x += a;
  14.                 i++;
  15.             }
  16.             catch (NumberFormatException exp){
  17.                 System.out.println("Должно быть введено число");
  18.             }
  19.         }
  20.         System.out.println(x);
  21.         read.close();
  22.     }
  23. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top