#define _CRT_SECURE_NO_WARNINGS #include<stdio.h> int main() { char a; int num = 0; int space = 0; int other = 0; while ((a = getchar()) != '\n') { if ((a >= '0') && (a <= '9')) num++; else if (a == ' ') space++; else other++; } printf("%d %d %d", num, space, other); system("pause"); return 0; }
输入字符串,统计其中数字,空格和其他字符的个数
原创
©著作权归作者所有:来自51CTO博客作者零点时光的原创作品,请联系作者获取转载授权,否则将追究法律责任
提问和评论都可以,用心的回复会被更多人看到
评论
发布评论
相关文章