Java
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | import java.util.Scanner; public class Main { static final int LIMIT = 6; public static void main (String[] arg) { Scanner sc = new Scanner(System.in); double[] weight = new double[LIMIT]; double avg = 0; for (int i=0; i<LIMIT; i++) { weight[i] = sc.nextDouble(); avg += weight[i]; } avg /= LIMIT; System.out.printf("%.1f", avg); } } | cs |