小白求问这个错在哪了

#include

int main()
{
int letters=0,spaces=0,numbers=0,others=0;
char c;
while((c=getchar())!='\n');
{
if(((c>='a')&&(c<='z'))||((c>='A')&&(c<='Z')))
{
letters+=1;
}
else if(c==' ')
{
spaces+=1;
}
else if(c>='0'&&c<='9')
{
numbers+=1;
}
else
{
others+=1;
}
}
printf("%d %d %d %d",letters,spaces,numbers,others);
return 0;
}
编译是通过的,但运行结果是0 0 0 1,随便什么输入都这样

while后面多了个分号

while后面多了个分号

循环,.........................................................

看你题目的意思应该是要判断一串字符串有多少字母、空格、数字和其他字符把,你用单个字符存不了,可以改为字符指针,而且算法也有问题。