Not "diet and exercise", just diet. Exercise doesn't contribute more than ~10% to weight loss (it helps for many other things but not that) - and if you're having trouble with the diet then it makes it more difficult because you get hungry, which sometimes cancels the entire thing out.
Well, the idea is probably not to gain weight in the first place. Once you gain weight it is very hard to lose it. Many people manage naturally to keep perfect BMI by eating healthy diet and having enough exercise or by just moving around. Exercise will have more health benefits than just keeping your body weight low.
IME exercise (combined with appropriate diet, mind you), actually reduces food intake for me. Or at least, makes it so I eat less net calories after removing the expenditure. But otherwise agreed, diet is the foundation.