← Back to Printing
Question 234
Simple Shopping Receipt
Simple Shopping Receipt
Combine interpolation, arithmetic, and multiple lines. Each item costs 3 dollars and you bought a quantity of 4. Print two lines: the first says how many items were bought, and the second shows the total cost (price times quantity). The output must read exactly: You bought 4 items. then on the next line Total cost: 12 dollars. Compute the total inside the interpolation.
Expected Output:
You bought 4 items. Total cost: 12 dollars.
= newline. The output ends with a newline — print one after the last line.
Hints2 available
Sign in to use hintsTopics:
Printing
1
Tab to indent (Esc then Tab to move on) · Ctrl+Enter to run · Shift+Alt+F to format · Ctrl+Space to expand shortcuts (cw, cr, fori)
Your Output
Run your code to see the output here...
Test Cases
Run your code to see test case results.