You don't need to go all the way to Zanzibar to enjoy beaches or the Indian Ocean. The coast of Tanzania Mainland has a lot to offer.
For example Pangani and Tanga, beautiful small towns located in the North of the coast region. It is much less touristic than Zanzibar, and it offers spectacular white, quiet beaches. You can experience the coast and ocean in a more local way.
If you pass through Dar es Salaam, the biggest city in Tanzania, you can also enjoy the coast side. You can find some wonderful beaches.
Bagamoyo is a historical site, located at the coast, North of Dar es Salaam. It is beautiful old town with wonderful beaches. This town carries a lot of history of East Africa, especially according to slavery. Actually it is a must to visit to get a good understanding of the history of Tanzania and East Africa.
Everywhere at the coast side you can do different activities, like snorkeling, diving, swimming, boat trips, watching dolphins.