c语言程序设计源程序(6)
发布时间:2021-06-06
发布时间:2021-06-06
课后作业,求最小值等题目答案
#include <stdio.h>
int main(void)
{
int letter=0,blank=0,digit=0,other=0;
char c;
while((c=getchar())!='\n'){
if(c==' ')
blank++;
else if(c>='1'&&c<='9')
digit++;
else if((c>='a'&&c<='z')||c>='A'&&c<='Z')
letter++;
else other++;
}
printf("letters=%d\n",letter);
printf("blank=%d\n",space);
printf("digit=%d\n",digit);
printf("other=%d\n",other);
return 0;
}