001-004-005

Variable Value Change: Age Calculator

Easy

Problem Description

Variable Value Change: Age Calculator

Learning Objective: Learn how to update variable values

Overview

Values stored in variables can be changed later. Let's create a program that calculates current age and next year's age!

Specifications

  • Initialize integer variable age to 10
  • Output current age
  • Add 1 to age and update it
  • Output next year's age

Output Format

Current age: 10
Next year: 11

Test Cases

※ Output examples follow programming industry standards

Input:
Expected Output:
Current age: 10
Next year: 11
❌ 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