004-004-004

For Loop: Countdown

Easy

Problem Description

For Loop: Countdown

Learning Objective: Implement descending loop processing with for loop

Display countdown from specified number. Use for loop to display while decreasing numbers.

Input

Line 1: Start number (integer, 1 or greater)

Output

[number]
[number-1]
...
3
2
1
Launch!
```java

## Examples

### Example 1: Countdown from 5
Input:
```java
5
```java
Output:
```java
5
4
3
2
1
Launch!
```java

### Example 2: Countdown from 3
Input:
```java
3
```java
Output:
```java
3
2
1
Launch!
```java

### Example 3: Countdown from 1 (Boundary)
Input:
```java
1
```java
Output:
```java
1
Launch!

Test Cases

※ Output examples follow programming industry standards

Input:
5
Expected Output:
5
4
3
2
1
Launch!
Input:
3
Expected Output:
3
2
1
Launch!
Input:
1
Expected Output:
1
Launch!
❌ Some tests failed
❌ エラー発生

Your Solution

Current Mode: My Code
import java.util.Scanner;
public class Solution {
public static void main(String[] args) {
// ユーザー入力を読むためのキーボードからの入力を読むScannerオブジェクトを作成
Scanner sc = new Scanner(System.in);
// ユーザーからの入力値を読んで格納
int n = sc.nextInt();
// アイテムをループして処理
for (int i = n; i >= 1; i--) {
// コンソール経由でユーザーに出力を表示
System.out.println(i);
}
// コンソール経由でユーザーに出力を表示
System.out.println("Launch!");
}
}

0 B / 5 MB

You have 10 free executions remaining