/ Published in: C
Expand |
Embed | Plain Text
/* count digits and others */#include <stdio.h> int main (int argc, const char * argv[]){ int c, i, nwhite, nother; int ndigit[10]; nwhite=nother=0; for(i=0; i<10; i++) ndigit[i]=0; while((c=getchar())!=EOF) if(c>='0' && c<='9') ++ndigit[c-'0']; elseif(c==' '||c=='\n'||c=='\t') ++nwhite; else ++nother; for(i=0; i<10; ++i) }
You need to login to post a comment.
