problem 8 in C