^ Zinc is good, better than sunscreen
Both sunburn and skin cancer are (usually) caused by UV exposure, but you can get burnt without getting cancer and get cancer without getting burnt. Melanoma (the bad type of skin cancer) is mainly associated with short bursts of intense exposure, like spending a day outside and getting badly burnt. The other much more common types (BCC & SCC) are generally associated with long-term regular exposure.
As others have said, sunscreen will greatly reduce your chances of getting burnt and of getting skin cancer, but won't completely prevent it. It's also a good idea for anyone who spends much time out in the sun, especially with fair skin, to keep an eye out for anything suspicious looking and to get annual skin checks with their GP