Advertisement
Guest User

Untitled

a guest
Oct 25th, 2014
140
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.48 KB | None | 0 0
  1. #include <stdlib.h>
  2. #include <ctype.h>
  3. #include <stdio.h>
  4.  
  5. int main()
  6. {
  7. unsigned long c;
  8. unsigned long line;
  9. unsigned long word;
  10. char ch;
  11.  
  12. c = 0;
  13. line = 0;
  14. word = 0;
  15.  
  16. printf("Please enter text:n");
  17. while((ch = getchar()) != EOF)
  18. {
  19. c ++;
  20. if (ch == 'n')
  21. {
  22. line ++;
  23. }
  24. if (ch == ' ' || ch == 'n')
  25. {
  26. word ++;
  27. }
  28. }
  29. printf( "%lu %lu %lun", c, word, line );
  30. return 0;
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement