#include<stdio.h> int main(void) { int letter,blank,digit,other;/*定义整数型变量*/ char ch; int i; letter=blank=digit=other; printf("Enter 15 characters:"); for(i=1;i<=15;i++){/*判断当i<=15时*/ ch=getchar(); if((ch>='a'&&ch<='z')||(ch>='A'&&ch<='Z'))/*判断*/ letter++; else if(ch>='0'&&ch<='9') digit++; else if((ch=' ')||(ch=' ')) blank++; else other++; } printf("letter=%d,digit=%d,blank=%d,other=%d ",letter,digit,blank,other); return 0; }