It is obvious that both good nutrition and exercise are necessary in order to get in shape. Asking which is more important is kind of like asking if it is more important to breathe in or breathe out. When I was younger I used to think that exercise was more important, but with time, I have learned to appreciate the role diet plays. I would actually say the results a person gets are about 70% due to diet and 30% to exercise.
Years ago while I was training in a big gym I conducted an informal survey over the course of a year. I asked people what percent of their fitness success they attribute to nutrition vs. exercise. I noticed some interesting trends. Typically those who put equal or greater emphasis on exercise were: 1) new to the gym, 2) more out of shape, or 3) younger with more forgiving metabolisms.
I then asked some of the people who were in incredible shape. These are the physical specimens that people stare at and tell their trainers they want to look like them. Without exception, everyone in the "fitness model physique" group attributed nutrition to be 65-80% of their results. These people obviously knew exercise is important too since they worked out religiously and I always saw them at the gym, but they had learned to fine tune the art of fueling their bodies properly.
Eating right can be more difficult than exercising. If you train hard, you can get a good workout in less than an hour, but the challenge of nutrition lasts all day long. Think about it, giving everything you've got for one last set of an exercise takes some mental toughness, but it is even harder to resist tempting food or overeating during the rest of the day when you are at work or home. Healthy eating requires not only the discipline to avoid unhealthy foods, but the planning and foresight to eat the right kinds of food throughout the day.
Both exercise and nutrition are important, but many of us are guilty of putting too much emphasis on exercise. If you haven't been taking what you eat seriously, I challenge you to clean up your eating for several weeks and take note of the changes it makes.