I wonder can cancer be inherited.

I chose this topic because my both sides of my family have a long history of cancer and I wanted to know if I could inherit it.