Don't use log (or any other function out of math.h). [There is a suggestion above about "how to do it if you don't know much math" which would work]
But I doubt there's much point to that. Using -lm is fine unless you have a particularly quirky tutor... [Or the particular wording to your project says "do not use the math library" or some such].
--
Mats