Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <string.h>
- int main()
- {
- char ch[1000];
- int line=0,word=0,character=0,i;
- while(gets(ch))
- {
- int len = strlen(ch);
- for(i=0; i<len; i++)
- {
- if(ch[i]==' ')
- {
- word++;
- }
- else
- {
- character++;
- }
- }
- word++;
- line++;
- }
- printf("characters %d , words %d , lines %d\n",character,word,line);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement