Why is this not giving correct output?

Why is this not giving correct output?