Import java.util.Scanner; import java.io.*; public class Sred { public static void main(String[] args) { Scanner in = new Scanner(System.in); int n; System.out.print("n="); n = in.nextInt(); int[] a = new int[n]; int sum = 0; for (int i = 0; i < n; i++) { a[i] = in.nextInt(); sum += a[i]; } float sred = (float)sum / n; System.out.printf("Среднее арифметическое: %.1f \n", sred); } }
import java.io.*;
public class Sred {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int n;
System.out.print("n=");
n = in.nextInt();
int[] a = new int[n];
int sum = 0;
for (int i = 0; i < n; i++) {
a[i] = in.nextInt();
sum += a[i];
}
float sred = (float)sum / n;
System.out.printf("Среднее арифметическое: %.1f \n", sred);
}
}