实验7-1-6 求一批整数中出现最多的各位数字
作者:互联网
#include<stdio.h>
int main(){
int n,i,j,num,max,numsum[10]={0,0,0,0,0,0,0,0,0,0};
scanf("%d",&n);
for(i=0;i<10;i++){
for(i=0;i<n;i++){
scanf("%d",&num);
if(num<0)num=-num;
while(num!=0){
numsum[num%10]++;
num=num/10;
}
}
max=numsum[0];
if(numsum[i]>max)max=numsum[i];
}
printf("%d:",max);
for(i=0;i<10;i++){
if(numsum[i]==max){printf(" %d",i);}
}
return 0;
}
标签:10,各位,数字,int,max,scanf,整数,main,numsum 来源: https://blog.csdn.net/weixin_62519708/article/details/122386690