Sensex ends flat, Nifty gains 228 points despite weak market breadth