C
1コード
#include <stdio.h>
int main(void)
{
int i,ch;
int cnt[10] = {0};
while ((ch = getchar()) != EOF ) {
if(ch >= '0' && ch <= '9')
cnt[ch - '0']++;
}
puts("数字文字の出現回数");
for (i = 0; i<10; i++)
printf(" '%d' : %d\n", i ,cnt[i]);
return 0;
}
/*./kadai13ren1
231414564
数字文字の出現回数
'0' : 0
'1' : 2
'2' : 1
'3' : 1
'4' : 3
'5' : 1
'6' : 1
'7' : 0
'8' : 0
'9' : 0
*/
回答2件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。