输入一行字符串,统计出现的各英文字母和数字字符各自出现的次数,英文字母不区别大小写。

    技术2022-08-01  79

    #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; }

    Processed: 0.011, SQL: 9