Advertisement
nuit

Untitled

Apr 13th, 2011
149
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.44 KB | None | 0 0
  1. #include <stdio.h>
  2.  
  3. int main ()
  4. {
  5.   char c;
  6.   int cNumbers=0,cCharacters=0,cNewline=0,cOthers=0;
  7.   while ((c=getchar()) != -1) {
  8.     if((c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z')) cCharacters++;
  9.     else if((c >= '0' && c <= '9')) cNumbers++;
  10.     else if(c == 10) cNewline++;
  11.     else cOthers++;
  12.   }
  13.   printf("\n\nNumbers: %d\nCharacters: %d\nNewlines: %d\nOther: %d",
  14.     cNumbers, cCharacters,cNewline,cOthers);
  15.  
  16.   return 0;
  17. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement