Getting Wrong Answer

Whats wrong with this logic? Getting Wrong answers