Roof collapses and electrocution were blamed for more than a dozen deaths, Pakistani news agency News Network International said.
Several mud houses also collapsed.
Geo TV News reported a family of six was washed away in floods in Haripur, and three died in an avalanche in Shangla.
Three others died when a roof and wall of two buildings collapsed in Hafizabad and Swabi.
The Pakistan Meteorological Department said the rain, which began Sunday, will persist until Wednesday.
Flights at the Islamabad and Karachi airports also were canceled due to the weather, NNI reported.