I'm trying to make a simple program to calculate the average GPA but during the output the statements don't stop when they are supposed to. I don't think there's any problem with the buffers in the printf statements as I'm using a new line in every sentence. This in output for example:
Enter a GPA: 
9
Do you want to calculate the average GPA until now?
Press 'y' for yes or 'n' for no: 
Enter a GPA: 
y
Do you want to calculate the average GPA until now?
Press 'y' for yes or 'n' for no: 
The average GPA is 9.0
As you can see the loop continues and it prints out the question again.
What am I doing wrong?
This is my code:
#include <stdio.h>
int main(void){
    /*************************Variable declarations************************/
    float fGPA;
    float fUserInput = 0;
    float fArray[30];
    int x;
    char cYesNo = '\0';
    /*************************Initialize array********************************/
    for(x = 0; x < 30; x++){
        fGPA = 0;
        printf("Enter a GPA: \n");
        scanf("%f", &fUserInput);
        fArray[x] = fUserInput;
        fGPA += fUserInput;
        printf("Do you want to calculate the average GPA until now?\n");
        printf("Press 'y' for yes or 'n' for no: \n");
        scanf("%c", &cYesNo);
        if(cYesNo == 'y' || cYesNo == 'Y')
            break;
        else if(cYesNo == 'n' || cYesNo == 'N')   
            continue;
    }//End for loop
    printf("The average GPA is %.1f\n", fGPA / x);
}//End main
 
     
     
    