/ Published in: C
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
#include <stdio.h> // count the digit, white space, and others int main() { char c,nwhite,nother; int ndigit[10]; nwhite = 0; nother = 0; for(int i = 0; i < 10; i++) ndigit[i] = 0; if ( c >= '0' && c <= '9' ) ++ndigit[c-'0']; else if ( c == '\n' || c == '\t' || c == ' ') ++nwhite; else ++nother; } int j = 9; while( j !=0 ){ --j; } return 0; }