Modified code for printing out frequencies of males and females.