There is no prevention strategy that will prevent all cancers. Even people with the most healthy lifestyle can get a cancer. That's why you have to do both.
Just to give one example: the majority of men will get prostate cancer if they live long enough (~70% of men over 80). It's just that other things tend to kill people before the cancer.