import java.util.Scanner;
public class BookTest7_3 {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
int[] counts = new int[100];
System.out.print(“请输入1-100的整数”);
int number = input.nextInt();
while (number != 0) {
if (number <= 100 && number >= 0) {
counts[number - 1]++; //角标为0——99
}
number = input.nextInt();
}
for (int x = 0; x < 100; x++) {
if (counts[x] > 0) {
System.out.println((x + 1) + "出现了" + counts[x] + "次");
}
}
}
}
还没想明白