Multiple AND operators with in IF statement

I am new to Arduino, and I am trying my hands on LCD (16 X 2) UNO shield with Left/right/up/down/select and reset buttons to write a user interface for a further bigger project in future.

  1. On intended user interface, I want user to select a number (N) by using up or down button followed by Select button. Maximum allowable number is 9 and minimum is 1.

  2. The up, down, select buttons are attached to Analog 0 pin by array of voltage divider. The voltage of A0 (after ADC) on pressing buttons is: up=100, down=257, and select = 641.

  3. After pressing Select button a new interface is intended to be presented for further action.

I am facing problem that in my code pasted below, as long as I do not keep the conditions of maximum allowable number 9 or minimum allowable number 1 in if statements of UP and DOWN button. I am able to get intended behavior of Up, down, select keys. But if I keep conditions of max 9 or min 1 up and down key does not behave as intended. What error I am making?

#include <LiquidCrystal.h>
LiquidCrystal lcd( 8,9,4,5,6,7 );  //interfacing pins
int N=1;
int readVolt=analogRead(0);
void setup()
{
// Set up the LCD's number of columns and rows:
  lcd.begin(16, 2);
// Print a brief BRAND RELATED message to the LCD.
  lcd.setCursor(0,0);
  lcd.print("Welcome Screen");
  delay(1000);
  // User Menu Interface on LCD to Set the Number, Maximum Numbers can be 9
  lcd.clear();
  lcd.setCursor(0,0);
  lcd.print("Select Number");
  lcd.setCursor(0,1);
  lcd.print("Max Allowed");
  lcd.setCursor(15,1);
  lcd.print(9);
  // User interaction by Up and Down key unless Select Button is Pressed
	do{
	readVolt=analogRead(0);
	lcd.setCursor(15,0);
	lcd.print(N);
	lcd.setCursor(15,0);

	if(readVolt < 120 && readVolt > 90 && N<=9){ // Up Button is Pressed
		N+=1;
		}

	  if (readVolt>230 && readVolt < 280 && N>=1){ // Down Button is Pressed
		N-=1;
		}
	} while(readVolt!=641); // Select Button is Pressed
   lcd.clear();
   lcd.print("New Menus");

  }

void loop()
{

}

This should be a range. Expecting exactly 641 is risky.

while(readVolt!=641) ;

Also, you have no guard against a long button press causing multiple updates to N. Just to test, you could add a delay of say 500 mS in your while loop.

I get that and I will put the range for while loop. Problem specifically is that in if statements while using conditions of N<=10 and N>=1 up and down key does not work without these conditions, the keys work. I want to limit the counter in range 1-9.

  if(readVolt < 120 && readVolt > 90 && N<=9){ // Up Button is Pressed
    N+=1;
    }

    if (readVolt>230 && readVolt < 280 && N>=1){ // Down Button is Pressed
    N-=1;
    }

IMO, this obscures and interferes with the intent because the value of N has no effect on whether the button is pressed. Separate the button sensing from the position sensing and work from there.

  if(readVolt < 120 && readVolt > 90){ // Up Button is Pressed
    if(N<9) N+=1;
    }

    if (readVolt>230 && readVolt < 280){ // Down Button is Pressed
    if(N>1) N-=1;
    }

Also, for consistency, arrange the compares so the low value's on the left for both buttons.

Thanks dougp , the suggested solution work partially:

A. In case, if in code both the conditions of up (N<9) and down (N>1) are set. Value toggle between 1 and 9 by pressing up and down keys. Instead of expected increments 1,2,3....9 or decrements 9,8,7....1.

if(readVolt > 90 && readVolt < 120){ // Up Button is Pressed
    if(N<9) N+=1;
    }
if (readVolt>230 && readVolt < 280){ // Down Button is Pressed
    if(N>1) N-=1;
    }

B. In case, condition of up (N<9) is removed but of down press (N>1) is kept in the code, expected behavior is seen. On pressing Up key number change to 1,2,3.......... and on down key ........3,2,1.

if(readVolt > 90 && readVolt < 120){ // Up Button is Pressed
    N+=1;
    }
if (readVolt>230 && readVolt < 280){ // Down Button is Pressed
    if(N>1) N-=1;
    }

C. Keeping (N<9) but removing (N>1) results in same behavior as A.
So there is some issue around up button code.

Thanks 6v6gt, Your solution of adding delay worked perfectly. delay(200) was ideal without compromising the fluidity of the button press.

I'm glad you got further with it. There are nicer ways of doing this without using delay() which blocks the execution of the sketch. I suggested delay() only as a test so it would be clear to you what was happening.
Probably after an update to N, you should not allow another update until the switch has been released and has stayed released for a few hundred milliseconds. Use the function millis() for this. May be also do a forum search for switch debounce.

I am really not seeking that user release the button to get the number increased. A long press with delay is the behaviour I rather seek. Are there any pitfalls to this approach?