003-005-008
Increment: Step Counter
Easy
Problem Description
Increment: Step Counter
Learning Objective: Accumulate values with increment operator
In this problem, you will create a program that receives an integer step count as input, accumulates the count using the increment operator (++), determines whether the 10,000-step goal has been achieved, and displays the result to standard output.
Declare an integer variable count and accumulate the count using count++ for each step in the input. If the final count is 10,000 or more, display "Goal achieved!"; otherwise, calculate and display the remaining steps.
Input
Line 1: Steps (integer)
Output
Steps: [steps] steps
Goal achieved!
Or
Steps: [steps] steps
[10000-steps] steps remaining
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