finished ex16.c