Why it isnot showing correct output