#include<stdio.h> int main() { int count=0; char a[100]; printf("请您输入一行字符: "); scanf("%s",a); for (int i = 0; a[i] != '\0'; i++) { if (a[i] > '0' && a[i] < '9') count++; } printf("字符串中数字个数为:%d", count); return 0; }