/* write a program that reads a sequence of characters, '*' terminates the input the program counts the number of digits and the number of special characters that are not '*' */ #include int main(){ char ch; int count_digit=0, count_special=0; /* while((ch=getchar())!='*'){ if(ch>='0' && ch<='9') count_digit++; else if(!((ch>='a' && ch<='z') || (ch>='A' && ch<='Z'))) count_special++; } printf("digits=%d, special=%d\n", count_digit,count_special); ch=getchar(); while(ch!='*'){ if(ch>='0' && ch<='9') count_digit++; else if(!((ch>='a' && ch<='z') || (ch>='A' && ch<='Z'))) count_special++; ch=getchar(); } printf("digits=%d, special=%d\n", count_digit,count_special); */ scanf("%c", &ch); while(ch!='*'){ if(ch>='0' && ch<='9') count_digit++; else if(!((ch>='a' && ch<='z') || (ch>='A' && ch<='Z'))) count_special++; scanf("%c", &ch); } printf("digits=%d, special=%d\n", count_digit,count_special); return 0; }