006-001-005
For Loop: Star Line
Easy
Problem Description
for loop: Star Line
In this problem, you will create a program that reads an integer and uses a for loop to print that many star characters (*) consecutively on a single line, displaying the result to standard output.
Learning Objective: Repeat specified times with for loop
Create a program that inputs a number and displays that many stars (*) in a horizontal line. Create visual feedback using a for loop.
Input
Line 1: Number of stars (integer)
Output
***...*
(stars displayed in horizontal line for specified count)
Examples
Example 1: 5 stars
Input:
5
Output:
*****
Example 2: 10 stars
Input:
10
Output:
**********
Example 3: 1 star (minimum)
Input:
1
Output:
*
Ready to Try Running Code?
Log in to access the code editor and execute your solutions for this problem.
Don't have an account?
Sign Up