006-001-006
For Loop: Countdown
Medium
Problem Description
for loop: Countdown
Learning Objective: Write repetitive processing using for loops
In this problem, you will create a program that counts down from an input integer to 1, printing each number on a separate line, then outputs "Go!" to standard output.
Create a program that counts down from a specified number. Use a for loop for repetitive processing.
Input
Line 1: Starting number (integer, 1-10)
Output
Count down from starting number to 1, then output "Go!"
Examples
Example 1
Input:
5
Output:
5
4
3
2
1
Go!
Example 2
Input:
3
Output:
3
2
1
Go!
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