The easy way to do it is to compare the variable z with the character literal 'y' or 'n'. Remove the variables called y and n and use 'y' and 'n' in your if statements.