Reformatted C version to conform to my current style. Also corrected a problem with inconsistent format specifiers.