#include"stdio.h"
#include"string.h"
int main()
{
const int n=100;
int i=0;
char str[n]={NULL};
int count1=0;
int count2=0;
scanf("%s",str);
while(str[i]!=’\0’)
{
if(str[i]>=‘a’&&str[i]<=‘z’||str[i]>=‘A’&&str[i]<=‘Z’)
{
count1++;
}
if(str[i]>=‘0’&&str[i]<=‘9’)
{
count2++;
}
i++;
}
printf(“数字个数:%d\n英文个数:%d\n”,count1,count2);
return 0;
}
输入一行字符串,统计出现的各英文字母和数字字符各自出现的次数,英文字母不区别大小写。
最新推荐文章于 2023-11-20 17:25:10 发布