Help me understand the difference in logic

correct : Solution: 52131089 | CodeChef
partially correct : Solution: 52131270 | CodeChef
I have commented the difference in both the code . Please tell me why i am getting one correct and one partial correct . The logic used in both the code is same .