Advertisement
Guest User

help

a guest
Feb 18th, 2020
136
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.34 KB | None | 0 0
  1. int words_3char(char *str){
  2. int i;
  3. int cnt = 0;
  4. int words = 0;
  5.  
  6. for (i = 0; str[i] != '\0'; i++){
  7. if (str[i] != ' ' && str[i] != '\0'){
  8. cnt++;
  9. } else if (cnt == 3) {
  10. words++;
  11. cnt = 0;
  12. } else {
  13. cnt = 0;
  14. }
  15. }
  16. return words;
  17. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement