Spiral numbers in C