As the title says, I need to do an integer division in C but just store the whole number answer. Is there an easy way to just drop everything after the decimal?
If both the dividend and divisor are of integer types, and positive, the result will be truncated. You might need to watch out for what happens if either is negative, but in any case the result is also going to be an integer (it's just a matter of whether it truncates in the direction you expect).
Hmm that makes sense. I'll admit my knowledge of C is very very limited. I'm doing a pretty simple program here, but it's not working out. Here's what I got: