Some of the risk of cancer can be inherited from your parents (and their parents…) and there are some rare but very dangerous genes, but most of the risk of cancer comes from other things like smoking and diet.
For some types of cancer (like breast cancer), there is familiar occurrence, so there is increased probability for other members of the family to develop cancer. However we are always talking of increased probability, but NEVER certainty. This is because familiar occurrence means that the family is carrier of a mutation in a gene that gives you predisposition to cancer. However, there is more than one mutation (I seem to remember 4 or 5) that has to happen in the genes to develop cancer. Imagine your cell like a chair with 4 legs. If you have a mutation in a gene that gives you predisposition to cancer, it’s as if one of the legs of the chair is already broken, but to develop cancer, all the 4 legs have to break down.
For sure, some people do get genes passed on by their parents that make them more susceptible to developing cancer. But cancer can also occur randomly, without inheriting ‘bad’ genes – especially if you’re exposed to a lot of risk factors like cigarette smoke, too much sunlight etc.
Some cancers are more likely to occur due to inherited faulty genes from your parents. For instance, inheriting mutations in the ‘BRCA1’ and BRCA2 genes increase the likelihood of women getting breast cancer. However, most forms of cancer are ‘sporadic’, meaning that there is no inherited cause.