public class T {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
double sum = 0;
double s = 0;
System.out.println("请输入10个数:");
int[] a = new int[10];
for (int i = 0; i < a.length; i++) {
a[i] = scanner.nextInt();
sum += a[i];
}
s = sum / a.length;
System.out.println("大于平均值的值如下:");
for (int i = 0; i < a.length; i++) {
if (a[i]>s) {
System.out.print(a[i]+" ");
}
}
}
}
import java.util.Scanner;
public class Test {
public static void main(String[] args) {
int num[] = new int[10];
Scanner sc = new Scanner(System.in);
for (int i = 0; i < 10; i++) {
num[i] = sc.nextInt(); }
double avg;
long sum = 0;
for (int i = 0; i < num.length; i++) {
sum = sum + num[i];
}
avg = sum / 10;
for (int i = 0; i < num.length; i++) {
if (num[i] > avg)
System.err.println("大于平均数的值为:"+num[i]);
}
}
}