003-004-011
Multiplication and Division Compound Assignment
Medium
Problem Description
Multiplication and Division Compound Assignment
In this problem, you will create a program that reads an initial price, multiplier, and divisor from standard input, then calculates the final product price by applying multiplication (*=) and division (/=) compound assignment operators sequentially to the price variable and displays the result to standard output.
Learning Objective: Understand multiplication (*=) and division (/=) compound assignment operators
Overview
Use multiplication and division compound assignment operators in product price calculation.
Input Format
initial price (integer)
multiplier (integer)
divisor (integer)
Specifications
- Read
price(initial price),multiplier, anddivisorfrom standard input - Multiply by
multiplierusing *= operator (total amount) - Divide by
divisorusing /= operator (discount applied) - Output the final price
Output Format
Final Price: 500
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