7-13

#include<stdio.h>
int main(void)
{
    int count,i;
    char str[80];

    printf("Enter a string:");
    i=0;
    while((str[i]=getchar())!='\n')
        i++;
    str[i]='\0';

    count=0;
    for(i=0;str[i]!='\0';i++)
        if(str[i]<='9'&&str[i]>='0')
            count++;
        printf("count=%d\n",count);
        return 0;
}

 

posted @ 2013-10-06 11:40  plusfancy  阅读(80)  评论(0编辑  收藏  举报