Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class E06numberInRange1to100 {
- public static void main(String[] args) {
- Scanner scanner = new Scanner(System.in);
- int num = Integer.parseInt(scanner.nextLine());
- while (num < 1 || num > 100) {
- System.out.println("Invalid number!");
- num = Integer.parseInt(scanner.nextLine());
- }
- System.out.println("The number is: " + num);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment