Advertisement
Guest User

Untitled

a guest
Jan 17th, 2018
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.56 KB | None | 0 0
  1. package com.javarush.task.task05.task0507;
  2.  
  3. /*
  4. Среднее арифметическое
  5. */
  6.  
  7. public class Solution {
  8. public static void main(String[] args) throws Exception {
  9. int x = 0;
  10. int a = 0;
  11. int b = 0;
  12. while (x != -1) {
  13. BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
  14. String s = reader.readLine();
  15. x = Integer.parseInt(reader.readLine(s));
  16. if (x != -1) {
  17. a = a + x;
  18. b = b + 1;
  19. }
  20. }
  21. System.out.println(a / b);
  22. }
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement