The polynomial intersects the x-axis 6 times, i.e. it has 6 real roots, so a degree-6 polynomial is enough.
f(c) = -(c-48)*(c-57)*(c-65)*(c-90)*(c-97)*(c-122)
This of course will waste time, doing 5 multiplications is much slower than 5 logical operations. Furthermore, &&
and ||
are short-circuiting so often you don't need to do all of them.