003-005-002
Increment: Step Counter
Easy
Problem Description
Increment: Step Counter
Learning Objective: Accumulate values with increment operator
Simulate step counter. Increase count with ++ for each step and check goal achievement.
Input
Line 1: Steps (integer)
Output
Steps: [steps] steps
Goal achieved!
```java
Or
```java
Steps: [steps] steps
[10000-steps] steps remaining
Test Cases
※ Output examples follow programming industry standards
Input:
12000
Expected Output:
Steps: 12000 steps Goal achieved!
Input:
7500
Expected Output:
Steps: 7500 steps 2500 steps remaining
Input:
10000
Expected Output:
Steps: 10000 steps Goal achieved!
❌ Some tests failed
Your Solution
Current Mode:● My Code
99
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
›
⌄
⌄
⌄
⌄
import java.util.Scanner;
public class Solution {
public static void main(String[] args) {
// ユーザー入力を読むためのキーボードからの入力を読むScannerオブジェクトを作成
Scanner sc = new Scanner(System.in);
// ユーザーからの入力値を読んで格納
int steps = sc.nextInt();
// コンソール経由でユーザーに出力を表示
System.out.println("Steps: " + steps + " steps");
// 条件をチェック
if (steps >= 10000) {
// コンソール経由でユーザーに出力を表示
System.out.println("Goal achieved!");
} else {
int remaining = 10000 - steps;
// コンソール経由でユーザーに出力を表示
System.out.println(remaining + " steps remaining");
}
}
}
0 B / 5 MB
You have 10 free executions remaining
