Not only do mammals have four legs but actually all terrestrial vertebrates (which include mammals) have four legs. There are slight exceptions though as some lineages have lost their legs. Typically snakes have no legs anymore.