002-004-001

Input Validation: Age Range Check

Easy

Problem Description

Input Validation: Age Range Check

Learning Objective: Check if input value is within valid range

In an age input program, verify age is within valid range (0-120) and display result.
Checking input values improves program reliability.

Input

Line 1: Age (integer)

Output

If age is within 0-120 range:

Valid age
Age: [age] years old
```java

If out of range:
```java
Invalid age

Test Cases

※ Output examples follow programming industry standards

Input:
25
Expected Output:
Valid  age
Age: 25 years old
Input:
0
Expected Output:
Valid  age
Age: 0 years old
Input:
150
Expected Output:
Invalid  age
❌ Some tests failed
❌ エラー発生

Your Solution

Current Mode: My Code
import java.util.Scanner;

public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
// Write your code here

sc.close();
}
}
0 B / 5 MB

You have 6 free executions remaining