Asking user for new value if condition is false

Hello all I have a mini project where i have to ask the user to input a positive value if its negative the user has to input a different value

I have
Int N;

Serial.print(“Enter value:”);
while(Serial.available ()==0);
if(N>1){
N=Serial.parseInt();
Serial.print(N);
}
else if (N<1){
return;
}

Am I in the wrong order or using different commands?

What does a negative number look like when the user enters it and your Arduino receives it?

Paul

I can see no place in the program where you even test for a negative number. A negative number is one that is less than zero.

When inputting a negative number nothing happens and after if you input a positive program freeses

sortabler:
When inputting a negative number nothing happens and after if you input a positive program freeses

Yes, but how does a negative number look to you? Is it -1234 or is it 1234- or is it <1234>, or what?

Paul

On the monitor:

Enter value:

Thats it but if i input a positive first before a negative then

Enter value: 7

I guess you don't read replies...

aarg:
I guess you don't read replies...

English is not the primary language?

Paul

I answered what my monitor shows after i input a number

//ive also tried

Int N;
Serial.print(“Enter value:”);
while(Serial.available ()==0);
N=Serial.parseInt ();
if(N>1){
Serial.println(N);
}
else if (N<1){
return;
}
}
void loop (){
}

// if i input a negative number first then positive nothing will print or return
//but if i input a positive first then it prints N

sortabler:
I answered what my monitor shows after i input a number

NO YOU DIDN"T ANSWER THE QUESTION!

How are you inputting a negative number?

Paul

-1 or ill input -2

Thank you for helping