用c语言统计一个字符串中有多少个数字字符。

#include<stdio.h>
int main()
{
    char ch;
     int count=0;
    while((ch=getchar())!='\n')
     {
        if(ch>'0'&&ch<'9')
              count++;
     }
     printf("%d\n",count);
     return 0;

}