New course! Every coder should learn Generative AI!
Try a free lesson0
In your division of charcount by words, both are int. You have to convert one of them to double, to keep the precision places.
0
I saw it. But that is not enough.
double x = 5 / 2 --> 2.0
double x = 5.0 / 2 --> 2.5
0
You have to init count with 1 ("abc def", one space, but two words).
Also you have to make input lower-case or check upper-case letters.