Hi everyone.

I am writing a program. A snippet of the code is below. In particular, I am trying to do a data validation ( see ****** below). I'm asking the user for certain inputs, and then I get to the Do while statement below, and when I execute the program, and I get to the point where I ask the user for a Y/N, it prints out the printf twice. I don't know if I'm making any sense. I realize that this is happening because once I enter data for a certain statement, I hit enter and that triggers the "Do while". How do I stop it from printing the statement twice. I'm using the Microsoft C/C++ compiler...which I here is different than compilers like borland. I must use C/C++ though.

printf("job grade? (soap handler=1, water manager=2, team manager=3,supervisor=4 :");
scanf("%d",&grade);
{
if(grade != 2 && grade!= 3 && grade != 4)
bonus2 = 25;

else if(grade != 1 && grade!= 3 && grade != 4)
bonus2= 45;

else if(grade != 2 && grade!= 1 && grade != 4)
bonus2 = 75;

else if(grade != 2 && grade!= 3 && grade != 1)
bonus2 = 100;
}



*************************************************
//once I hit enter from the previous input, it triggers this do while and prints
Employee worked 3 overtimes?
You must enter a Y or a N

Employee worked 3 overtimes?
You must enter a Y or a N//


do
{
printf("\nEmployee worked 3 overtimes? : ");
printf("\nYou must enter a Y or a N : ");
scanf("%c",&ans);
*************************************************
}
while(!(ans == 'Y' || ans == 'N'));


{
if (ans =='Y')
bonus3 = 50;

else
bonus3 = 0;
}