I am trying:- To re-read the value if user enters an invalid value. But the problem is `scanf()` executes only once and won't execute any other time and programs gets stuck with an infinite loop. 

```
#include<stdio.h>
#include<math.h>
main()
{
    unsigned int a;
    unsigned int b = pow(2,M-1);
    unsigned int c;
    int x;

    printf("b = %i",b);

    input:
    fflush(stdin);
    fflush(stdout);
    printf("\nEnter any integer: ");
    x = scanf("%u",&a);

    printf("%u",a);
    if(x==0) 
        goto input;

    printf("\na = %i",a);

    c = a & b;

    printf("\nc = %i",c);

    if(c)
        printf("\nthe bit %i is set",M);
    else
        printf("\nthe bit %i is not set",M);
}

```

I've tried using adding space before `%u` and also tried `fflush(stdin)` but nothing worked.

EDIT: I know that the use of goto is not recommended but I have to do it this way. (Using loop is not an option). M is a macro which I define using the gcc command line at compile time.