Completed problem 15 in C