003-004-005
Assignment Operators: Using Compound Assignment
Easy
Problem Description
Assignment Operators: Using Compound Assignment
In this problem, you will create a program that applies += and *= compound assignment operators sequentially to an initial value and displays the result of each step to standard output.
Learning Objective: Understand compound assignment operators (+=, -=, *=, /=)
Input initial value and operations, calculate using compound assignment operators.
Input
Line 1: Initial value (integer)
Line 2: Value to add
Line 3: Value to multiply
Output
Initial: [initial value]
After add: [after addition]
After multiply: [after multiplication]
Example
Input:
10
5
2
Output:
Initial: 10
After add: 15
After multiply: 30
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