Why is penicillin injected whereas ampicillin is taken orally?

Penicillin is sensitive to stomach acid and gets destroyed, so it is given as an injection.

Ampicillin is acid-resistant and can be absorbed through the digestive system.