fork download
  1. import java.util.*;
  2. import java.lang.*;
  3. import java.io.*;
  4. import java.util.Scanner;
  5.  
  6. class Ideone
  7. {
  8. public static void main (String[] args) throws java.lang.Exception
  9. {
  10. String name;
  11. double salary, totalSalary=0, employeesNum=0;
  12. Scanner in = new Scanner(System.in);
  13.  
  14. while (in.hasNext())
  15. {
  16. name = in.next();
  17. salary = in.nextDouble();
  18. totalSalary+=salary;
  19. employeesNum++;
  20. }
  21. System.out.println(totalSalary/employeesNum);
  22. }
  23. }
Success #stdin #stdout 0.07s 4386816KB
stdin
Ivanov 100
Ivanov 300
stdout
200.0