Https://ide.codingblocks.com/s/267979

why my code is not giving right output

hi @Aditya-Kushwaha-914550392281281 since you are using the += shorthand notation, you dont need to add cnt again. The way you have written it right now, it will get added twice, and give wrong answer.
image this statement will suffice.

Please mark the doubt as resolved in case of no further queries :slight_smile: