Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- int main ()
- {
- char c;
- int cNumbers=0,cCharacters=0,cNewline=0,cOthers=0;
- while ((c=getchar()) != -1) {
- if((c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z')) cCharacters++;
- else if((c >= '0' && c <= '9')) cNumbers++;
- else if(c == 10) cNewline++;
- else cOthers++;
- }
- printf("\n\nNumbers: %d\nCharacters: %d\nNewlines: %d\nOther: %d",
- cNumbers, cCharacters,cNewline,cOthers);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement