-
You need to understand about how division works.
There are two types of numbers in C. One is integers, whole numbers. One is floating point, decimal numbers.
If you need/want the decimals, you need to make sure one variable is a floating point. You can do it via a simple cast.
Then, you need to tell printf that it's actually printing a floating point number. This can be done via %f.
So, all in all, it might look like:
Code:
float word_average = (float)letter_count/word_count;
printf("%f", word_average);
-
If your going to keep adding, might I suggest organizing this into seperate functions.
Also a debugger usually helps to, it allows you to step through your code and look at variables. Visual Studio is good about this and gdb-insight is good as well, although it takes forever to build the files.