This code is not giving me correct answer why?

Hello @anshulgurawalia i have corrected your code and commented the mistake: