本题要求编写程序,输入10个字符,统计其中英文字母、空格或回车、数字字符和其他字符的个数。

问题描述:

img


请问我这个哪里错了????????

img


img

img

大致看没什么问题?
贴一下程序实际输出或报错信息?


#include<stdio.h>
int main()
{
  int letter=0,blank=0,digit=0,other=0,i=1;
  char ch;
  for(i;i<=10;i++){
    ch=getchar();
    if(ch==' ' || ch=='\n')
      blank++;
    else if(ch>='a' && ch<='z' || ch>='A' && ch<='Z')
      letter++;
    else if(ch>='0' && ch<='9')
      digit++;
    else
      other++;
    }
printf("letter = %d, blank = %d, digit = %d, other = %d",letter,blank,digit,other);
  return 0;
}