Project Euler problem 11 in C