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


Wrong answer

@Shlok,

your logic is correct. Just use long instead of int.