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
ageto 10 - Output current age
- Add 1 to
ageand 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
99
1
2
3
4
5
6
7
8
9
10
›
⌄
⌄
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
