do while loop

I am asking the user to enter a number in the key board between 2 and 100 and if the user doesn't enter a number that is in range then ask the user to enter a number again. This is what I have:

          printf("How many numbers?:"); 
          scanf("%d", &SIZE); 
          }while(SIZE>2 && SIZE >100); 

It works when i enter value greater then 100 which is correct and it ask the user to enter in another number, but when i enter values less then 2 it doesn't work.
Your loop says to loop when SIZE is above 2 and above 100. (I think this is a typo.) So it will loop whenever you input a number above 100.
that is what i am having trouble with. I don't understand the while condition that i need to do this. Can you tell me what it would be and can you explain it to me if you don't mind. THANKS
Let me explain you this:
SIZE > 2 && SIZE > 100
is equal to
SIZE > 100
because every number > 100 is > 2.
Maybe you want to do this:
}while(SIZE>2 && SIZE<100)
If you want to accept 2 and 100 too, use >= and <= instead of > and <.
thanks for your replay. }while(SIZE>2 && SIZE<100) this is the opposite of what i need. I need to accept numbers that are greater then 2 and less then 100 so if the user enters 1 it should ask the user to enter a number again and if the user enter 101 then the user need to enter a number again. Finally if the user enter anything between 2 and 100 then it works.

Sorry, i got it wrong- my fault.
it fine so what i did is }while(SIZE<=2 && SIZE>=100) but it wouldn't work so i am not sure what i am doing wrong can you tell me what it should be. THANKS
You need to change && with ||, like this:
} while(SIZE <= 2 || SIZE >= 100)
Topic archived. No new replies allowed.