标签:static col string span rand package ann can rgs
package task1; import java.util.*; public class q { public static void main(String[] args) { Scanner input = new Scanner(System.in); int[] a = new int[10]; System.out.println("请输入10位评委的分数:"); for (int i = 0; i < 10; i++) { a[i] = input.nextInt(); } int max, min, sum; max = a[0]; min = a[0]; sum = 0; for (int i = 0; i < 10; i++) { if (max < a[i]) { max = a[i]; } if (min > a[i]) { min = a[i]; } sum = sum + a[i]; } int aver; aver = (sum - max - min) / 8; System.out.println("去掉最高分和最低分后的平均分是:" + aver); } }
package task1; import java.util.*; public class q { public static void main(String[] args) { int[] a = new int[10]; Random r = new Random(); for (int i = 0; i < 10; i++) { a[i] = r.nextInt(100); } for (int i = 0; i < a.length - 1; i++) { for (int j = 0; j < a.length - 1 - i; j++) { if (a[j] > a[j + 1]) { int temp = a[j]; a[j] = a[j + 1]; a[j + 1] = temp; } } } System.out.println("排序后输出为:"); for (int i = 0; i < 10; i++) { System.out.println( a[i]); } } }
package task1; import java.util.*; public class q { public static void main(String[] args) { int[] a = new int[7]; Random r = new Random(); for (int i = 0; i < 7; i++) { a[i] = r.nextInt(35) + 1; } System.out.println("随机生成的数为:"); for (int i = 0; i < 7; i++) { System.out.println(a[i]); } } }
标签:static col string span rand package ann can rgs
原文地址:https://www.cnblogs.com/sehnsucht/p/12712768.html