Project Euler Hackerrank Solution C