An earlier answer has the right idea, and it's probably good enough for your assignment.

One of the reasons for writing code is a "down-to-the-metal" language like C is to make code that runs faster and/or smaller. So, it's usually worth thinking about the shortest, and computationally simplest way to get a calculation done. Math helps a lot with that.

I'd describe the numbers you're testing for as the odd multiples of five: 5, 15, 25, ...; and if negative numbers can occur then include -5, -15, etc. Looking at the list, those are the number that end with 5 (in base ten, anyway). A more mathematical way of saying that is "numbers equivalent to 5, modulo 10".

If C's remainder operator (%) was truly a modulo operator, as many people like to call it, then the obvious test would work:

if (n % 10 == 5) { ... it's a multiple of 5, but not 10 ... }

Sadly, the % operator is NOT a modulo operator--not when n can be negative. It's a remainder operator; and the above test will fail if n == -15, since (-15) % 10 produces a remainder of -5, not 5. So, you can't test for a==b(mod c) with a%c == b%c. Instead, you need to test: (a-b)%c == 0.

if ((n - 5) % 10 == 0) {... it's an odd multiple of 5, even if n is negative ... }

If your goal is to be an application programmer, you probably won't have to worry about this kind of "micro optimization". Typically, you'll be minimizing time spent coding and debugging rather than making a program run faster or fit in a smaller ROM. And you probably won't be using C.

C is still important in an embedded system with limited hardware, where inefficient code can lead to needing more hardware and increase the cost of a the final product. And, this is the sort of thinking that can provide an edge in programming competitions--if you're into that sort of thing.