C code for threes project