美文网首页
1021 个位数统计 (15 分)

1021 个位数统计 (15 分)

作者: 79d12e22ec53 | 来源:发表于2019-04-30 10:38 被阅读0次
#include<stdio.h>

int main()
{
    int count[10] = {0}, num=0;
    char c;

    while((c=getchar()) != '\n')
    {
        num = c - '0';
        count[num] ++;
    }

    int i=0;
    for(i=0;i<10;i++)
    {
        if(count[i] != 0)
            printf("%d:%d\n", i, count[i]);
    }
}


相关文章

网友评论

      本文标题:1021 个位数统计 (15 分)

      本文链接:https://www.haomeiwen.com/subject/lbsmnqtx.html