1.求出上面数组中0-9分别出现的次数
@Test
public void zuoye01(){
/* int[] scores={0,0,1,2,3,5,4,5,2,8,7,6,9,5,4,8,3,1,0,2,4,8,7,9,5,2,1,2,3,9};
求出上面数组中0-9分别出现的次数
双重for循环*/
int[] scores={0,0,1,2,3,5,4,5,2,8,7,6,9,5,4,8,3,1,0,2,4,8,7,9,5,2,1,2,3,9};
for(int num = 0; num <= 9; num++){ //数字是从0-9
int count01 = 0;
for(int i = 0; i <= scores.length - 1; i++){
if(num == scores[i]){ //运行300次
count01++;
}
}
System.out.println(num+": "+count01);
}
}
@Test
public void zuoye01(){
/* int[] scores={0,0,1,2,3,5,4,5,2,8,7,6,9,5,4,8,3,1,0,2,4,8,7,9,5,2,1,2,3,9};
求出上面数组中0-9分别出现的次数
双重for循环*/
int[] scores={0,0,1,2,3,5,4,5,2,8,7,6,9,5,4,8,3,1,0,2,4,8,7,9,5,2,1,2,3,9};
for(int num = 0; num <= 9; num+