Please tell me error in my code i am not getting correct answer and i think logic i wrote is correct

hello @anantgovil123

image

here it should be a[i]

https://ide.codingblocks.com/s/342296 i did that still wrong answer is coming

initialise cn with 1.