Doubt on missing number in array using sum method

https://ide.codingblocks.com/s/298143

Shows segmentation fault…please explain why