006-001-009
For Loop: Countdown
Easy
Problem Description
for loop: Countdown
In this problem, you will create a program that reads a start value and an end value using Scanner, then uses a for loop to count down from the start value to the end value.
Learning Objective: Understand how to use a decrementing counter in for loops
Overview
Create a program that reads a start value and an end value from standard input, then counts down from the start value to the end value using a for loop.
Specifications
- Read a start value and an end value from standard input, one per line
- Use a for loop for repetition
- Output integers from start to end in descending order, one per line
Input Format
start
end
Output Format (example: start=5, end=1)
5
4
3
2
1
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