void
main()
{
char
str[100],*p
int
num[11],i
p=str
gets(str)
for(i=0i<11i++)
num[i]=0
for(*p!='\0'p++)
{
if((*p<贺册='9'&&*p>='0'))
num[0]++
if(*p=='1')
num[1]++
if((*p=='2'))
num[2]++
if((*p=='3'))
num[3]++
if((*p=='4'))
num[4]++
if((*p=='5'))
num[5]++
if((*p=='6'))
num[6]++
if((*p=='7'))
num[7]++
if((*p=='8'))
num[8]++
if((*p=='9'))
num[9]++
if((*p=='做消0'))
num[10]++
}
printf("数字的总个事故:%d\n",num[0])
printf("1的个数%d\n",num[1])
printf("2的个数%d\n",num[2])
printf("3的个数%d\n",num[3])
printf("4的个数ª%d\n",num[4])
printf("5的个数%d\n",num[5])
printf("6的个数%d\n",num[6])
printf("7的个数%d\纯拍知n",num[7])
printf("8的个数%d\n",num[8])
printf("9的个数%d\n",num[9])
printf("0的个数%d\n",num[10])
}
#include <stdio.h>#define N 1000
void sort(int a[], int n)
{
int i, max, k
int count = 5
while( count )
{
max = a[0]
k = 0
for( i = 0i <ni++ )
{
if( max <a[i] )
{
max = a[i]
k = i
}
}
count--
printf("%d %d\n", k + 1, max)
a[k] = -1
}
}
int main(int argc, char const *argv[])
{
int a[1000] = {0}
int n, i, m
scanf("者敏%d"首吵枝, &n)
while( n-- )
{
scanf("碰枣%d", &m)
a[m - 1] += 1
}
sort(a, N)
return 0
}
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)