Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.javarush.task.task05.task0507;
- /*
- Среднее арифметическое
- */
- public class Solution {
- public static void main(String[] args) throws Exception {
- int x = 0;
- int a = 0;
- int b = 0;
- while (x != -1) {
- BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
- String s = reader.readLine();
- x = Integer.parseInt(reader.readLine(s));
- if (x != -1) {
- a = a + x;
- b = b + 1;
- }
- }
- System.out.println(a / b);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement