002-004-011

Numeric Input Range Validation

Medium

Problem Description

Numeric Input Range Validation

In this problem, you will create a program that reads one integer using Scanner, determines whether the value falls within the range of 1 to 100 inclusive, and displays the result to standard output.

Learning Objective: Implement range checking for Scanner input values

Overview

Read an integer from the user and determine if it falls within the range of 1 to 100, then output the result.

Specifications

  • Read one integer using Scanner
  • Output "Valid" if the input is between 1 and 100 inclusive
  • Output "Invalid" if outside the range

Input Format

50

Output Format

Valid

Ready to Try Running Code?

Log in to access the code editor and execute your solutions for this problem.

Don't have an account?

Sign Up