int n2 = 0; int licznik = 0; do{ System.out.println("Podaj liczbe"); int x = input.nextInt(); n2 = x; if((x > 0) && (x < 151)) licznik ++; } while(licznik == 0);