#include #include char sentence[1000]; int i; int j; int total; int wordlength(char line[], int i){ while (line[i] != ' '){ ++i; ++j; } return(j); } void printwords(char string[]){ total = 0; j = 1; for (i = 0; i < strlen(string); (i = i + j)) { if (wordlength(string, i) > 3) ++total; j = 1; } printf("There are %d words in that sentence.\n",total); return; } int main(){ printf("Input a sentence and I'll count the words.\n"); printf("A word is at least 4 characters long.\n"); fgets(sentence,sizeof(sentence),stdin); printwords(sentence); return (0); }