题解 | #统计大写字母个数#
统计大写字母个数
https://www.nowcoder.com/practice/434414efe5ea48e5b06ebf2b35434a9c
#include <stdio.h> #include <ctype.h> #define LEN 250 int main() { char s[LEN]; while (fgets(s, sizeof(s), stdin) != NULL) { int count = 0; for(int i = 0; s[i] != '\n' && s[i] != '\0'; i++) { if(isupper(s[i])) count++; } printf("%d\n", count); } return 0; }