package com.company; import java.util.*; public class Main { public static void main(String arg[]) { Scanner input = new Scanner(System.in); double sum = 0; int m = 0; while (input.hasNextDouble()) { double x=input.nextDouble(); m++; sum+=x; } System.out.printf("%d个数的和为%f ",m,sum); System.out.printf("%d个数的平均值为%f ",m,sum/m); } }