Some dinosaurs were carnivores (meat-eaters) but most were herbivores (plant-eaters). This is true for all animal populations. In any food chain, there have to be more organisms at the lower levels of the chain because the transfer of food energy is inefficient and much of the energy is lost at each stage of the process.
A large number of plants (called producers or autotrophs) can support a smaller number of plant-eaters (called primary consumers). These plant-eaters are eaten by a smaller number of carnivores (secondary consumers).
For example, it may have taken hundreds of acres of plants to feed a small group of Triceratops. These Triceratops could supply a single T. rex with enough food to survive over its lifetime.
If you look at dinosaur genera, roughly 65 percent of the dinosaurs were plant eaters and 35 percent were meat-eaters (or omnivores). If you look at the number of actual fossils found, the percentage of plant-eaters increases, since many fossils of some of the plant-eaters have been found. For example, over a hundred Protoceratops fossils have been found, but only about a dozen T. rex fossils have been found.