Genetics play a significant role in cancer risk. Certain gene mutations, such as those in the BRCA1 and BRCA2 genes, are well-known for increasing the risk of breast and ovarian cancers. Genetic testing can help identify individuals at high risk, enabling them to take preventive measures or undergo regular screenings for early detection.