Exactly as I pointed out in my msg, incrementing %y inside the if statement .. then using %y in the last echo to calculate the percentage.

The %x variable has nothing to do with it, which is what riamus is saying, which is why I was getting confused.