Books allocation implementation

my code is correct but answer is coming wrong i cant figure it out
here is my code https://ide.codingblocks.com/s/267749

@jatinupadhyay786 you initialised sum with 0, therefore, e is also 0, and the while loop is never executed. (because s <= e condition fails)