Suppose the continuous nonnegative function has somewhere. Continuity supplies a positive-length interval within on which ; at an endpoint use a one-sided interval. By monotonicity of the Riemann integral, its contribution to the integral is strictly positive, a contradiction. Therefore under the stated continuous-function assumptions.
For the general integrable case, choose and let while for . This nonnegative indicator function is Riemann integrable with integral zero: isolate in partition intervals of arbitrarily small total length, making the upper sum arbitrarily small while the lower sum stays zero. Yet . This is the single-point changes preserve Riemann integrals phenomenon and supplies the counterexample.