Final version of quiz3.c