#include
/* count digits, char, others */
main()
{
int c, i, nchar, nother;
int ndigit[10];
nchar = nother = 0;
for (i = 0; i < 10; ++i)
ndigit[i] = 0;
while ((c = getchar()) != EOF)
if (c >= '0' && c <= '9')
++ndigit[c-'0'];
else if (c >= 'a' && c <= 'z' || c >='A' && c<='Z')
++nchar;
else
++nother;
printf("digits =");
for (i = 0; i < 10; ++i)
printf(" %d", ndigit[i]);
printf(", white space = %d, other = %d\n", nchar, nother);
}
#include "stdio.h"
void main( void )
{
char string[50];
int length,i,num;
printf("Please input the string");
gets(string);
length=strlen(string);
num=0;
for(i=0;i
if(string[i]<='9'&&string[i]>='0')
num++;
}
printf("\nThere are %d num",num);
printf("\n%d other charactors",strlen-num);
}