C : while( scanf("%d",&num) != 1 ) infinite loop

hope you could help me with this I have to use scanf to read and validate inputs… I’ve tried this code: int num = 0; while( scanf("%d",&num) != 1 || num < 3 || num > 9){ printf("Enter new num: "); } when I input numbers it works great but when I input any other… Read More C : while( scanf("%d",&num) != 1 ) infinite loop