这个程序哪里有问题啊🤨

/输入十个字符,统计英文字母,数字字符和其他字符/
#include
int main()
{int i,digit,letter,other;
char ch;
digit=0;
letter=0;
other=0;
printf("Enter 10 character:");
for(i=1;i<=10;i++)
ch=getchar();
if((ch>='a'&&ch<='z'||ch>='A'&&ch<='Z'));
{
letter++;
else if(ch>="0"&&ch<='9')
digit++;
else
other++;
}
printf("letter=%d,digit=%d,other=%d",letter,digit,other);
return 0;
}

img

修改如下,供参考:

#include <stdio.h>
int main()
{
    int i, digit, letter, other;
    char ch;
    digit = 0;
    letter = 0;
    other = 0;
    printf("Enter character:");
    while ((ch = getchar()) != '\n') {   //for (i = 1; i <= 10; i++)  修改
                                         //ch = getchar();
        if ((ch >= 'a' && ch <= 'z' || ch >= 'A' && ch <= 'Z'))//; 分号多余
        //{  多余
            letter++;
        else if (ch >= '0' && ch <= '9')  //ch >= "0" && ch <= '9'
            digit++;
        else
            other++;
        //} 多余
    } //  修改
    printf("letter=%d,digit=%d,other=%d", letter, digit, other);
    return 0;
}

else if(ch>="0"&&ch<='9')
0这里你用了双引号,被程序解释喂字符串字面量,编译为对应的内存地址

先不谈结果 从格式上,if 与 else的组合有问题 15行的else不能直接放到if中 12行的if判断条件中怎么多了个;
粗略一看问题就不少 先把格式改对了再考虑结果

if语句后面不用加{},把if语句大括号删了

else if(ch>="0"&&ch<='9')

双引号改成单引号

else if(ch>='0'&&ch<='9')

双引号表示字符串,单引号表示字符