1
0
mirror of https://github.com/renbaoshuo/202401-programming-assignments.git synced 2024-12-16 15:44:39 +00:00
202401-programming-assignments/【额外练习】循环结构/7-2 循环-找数字.c

22 lines
300 B
C

#include <stdio.h>
#include <string.h>
int main() {
char str[100];
int count = 0;
gets(str);
int len = strlen(str);
for (int i = 0; i < len; i++) {
if (str[i] >= '0' && str[i] <= '9') {
count++;
}
}
printf("%d\n", count);
return 0;
}