It sounds like you need a variable to store the number of passing grades in. When the loop is over, you can then put that variable into your conditionals.

Edit: Because you are always entering...