I frankly can't understand what you think you are doing! Much of what you are doing is determining where f(x)= 0. Okay that is at x= 5, which you have, and x= 0, which you ignore, but that is irrelevant anyway! The average value of a function, f(x), over interval a to b is the integral of f, from a to b, divided by b- a. But you show no attempt at integration!