public class Test
{
public static void main(String[] args)
{
int[] randomNumbers = new int[100];
int[] counts = new int[10];
for(int i = 0; i < 100; i++)
{
randomNumbers[i] = (int)(Math.random() * 10);
counts[randomNumbers[i]]++;
}
for(int i = 0; i < 10; i++)
{
System.out.println(i + " occurs " + counts[i] + " times");
}
}
}
6-7 编程练习题答案
最新推荐文章于 2021-03-15 00:31:08 发布