Guest User

Untitled

a guest
Dec 9th, 2018
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.37 KB | None | 0 0
  1. int main(void)
  2. {
  3. int c, countSpaces = 0;
  4.  
  5. printf("Type sentence:n");
  6.  
  7. do
  8. {
  9. c = getchar();
  10. if (c == ' ')
  11. countSpaces = countSpaces + 1;
  12. }
  13. while (c != 'n');
  14.  
  15. printf("Sentence contains %d Spaces.n", countSpaces);
  16.  
  17. return 0;
  18. }
  19.  
  20. if (c != EOF)
  21. countSpaces = countSpaces + 1;
  22. }
  23. while (c != 'n');
  24.  
  25. printf("Sentence contains %d Spaces.n", countSpaces - 1);
Add Comment
Please, Sign In to add comment