A possible solution is to think about it backwards: Accept a float as input and reject the input if the float is not an integer:
int n;
float f;
printf("Please enter an integer: ");
while(scanf("%f",&f)!=1 || (int)f != f)
{
...
}
n = f;
Though this does allow the user to enter something like 12.0, or 12e0, etc.