Struggling Yahoo! sees profit rise in upbeat quarter