If the probability is significantly high and you're 45+ and done with having kids then it's a no brainer imo if your insurance will cover it or at least most of it less some reasonable deductible and coinsurance.
Yeah if it's your lungs then obviously stop smoking (anything), stay away from factories, get a radon mitigation system in your basement if you have one. If you smoked then get a chest x-ray once a year, it's typically covered by insurance.
Obviously there's a few of the rarer cancers like glioblastoma that you cannot typically predict and literally not do anything about, but they're relatively rare, similar to something like ALS or Huntington's disease.
For people at average risk for all cancer (i.e. not at a genetically heightened risk) there are many things you can do to prevent cancer, such as eating an antioxidant rich diet, minimizing both added sugars and artificial sweeteners, not eating fast food and minimizing greasy fried foods, don't eat french fries or otherwise deep fried potatoes like tater tots etc, don't eat charred well done meats, don't eat processed meats that contain nitrites or added nitrates, don't eat stuff like candy or pastries more than once or twice per year, don't smoke (cigs/cigars/weed/e-cigs are all roughly equally bad), minimize drinking to one drink per night or less, exercise plenty, minimize stress, minimize exposure to emotional trauma and/or depression, maximize adrenaline and happiness in life (that's underrated), and maintaining a good social life and sex life helps too surprisingly enough. Loners live shorter lives.
Also, sleeping at least eight hours per 24 hour day (i.e. night) on average is invaluably important, because your brain, organs, and cells need downtime to rest and recuperate. People who are chronically sleep deprived due to work or other life drama also live shorter lives.