In short: BOTH.
Have you ever heard anyone say that exercise alone won’t help you lose weight? Or that it's all in the diet? While that may have some truth to it, no weight loss program is complete without an adequate training program included in it. When you add exercise to a balanced, healthy diet, it really helps with weight management and weight loss.
When trying to lose weight by dieting alone, you can only go down so low in calories (1,200 for females / 1,600 for males). If you are starving yourself and you’re constantly hungry, you are more likely to binge and come off your diet. You may lose weight initially, but when you hit a plateau in weight loss, you can’t continue to restrict calories. This is where exercise comes into it. As your body gets use to dieting and you start to plateau, you can then add in more cardio or up the intensity to burn more calories and continue dropping weight.
Some people believe exercising will cause you to be more hungry and eat more food, therefore you'll be unable to lose weight. Studies have shown that exercise doesn’t trigger you to eat more, but dieting alone might. So if you are seriously looking to slim down, it would benefit you to hit the gym and begin a healthy food plan, rather than go on any crash hot diets or eliminate entire food groups. As little as 30 minutes of vigorous exercise 5 x per week is enough to get the weight moving.