Using a function to find letters and words <p>I'm trying to get the answer of the number of letters/number of words... I'm having problems with the word counting.</p> <p>Actually in here i only declare that a new word is if there is a space, tab, of a newline, but is still doesn't work.. </p> <p>This is my function:</p> <pre><code>int num_of_letters_words() { int numberOfLetters = 0; int numberOfWords = 0; int userInput; int answer; printf("please enter your input:\n"); while ((userInput = getchar()) != EOF) { if (ispunct(userInput)) continue; else if(userInput == '\n') continue; else if (userInput == ' ') continue; else if (iscntrl(userInput)) continue; else if (userInput == ' ') ; else numberOfLetters++; if (userInput == ' ' || userInput == '\n' || userInput == '\t') numberOfWords++; } answer = numberOfLetters/numberOfWords; return answer; } </code></pre> <p>Only in the end of the function you can see the words counter... What is wrong here? </p>