Completed problem 20 in C