006-001-005
For Loop: Star Line
Easy
Problem Description
For Loop: Star Line
Learning Objective: Repeat specified times with for loop
Create program that inputs number and displays that many stars (*) in a horizontal line. Create visual feedback using for loop.
Input
Line 1: Number of stars (integer)
Output
***...*
```java
(stars displayed in horizontal line for specified count)
## Examples
### Example 1: 5 stars
Input:
```java
5
```java
Output:
```java
*****
```java
### Example 2: 10 stars
Input:
```java
10
```java
Output:
```java
**********
```java
### Example 3: 1 star (minimum)
Input:
```java
1
```java
Output:
```java
*
Test Cases
※ Output examples follow programming industry standards
Input:
5
Expected Output:
*****
Input:
10
Expected Output:
**********
Input:
1
Expected Output:
*
❌ 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 9 free executions remaining
