โ Back to Printing
Question 15
Complex Product Display
Complex Product Display
Create variables: char item[] = "Laptop", int quantity = 3, float price = 899.99f. Calculate the total cost (quantity * price) and use printf to create this formatted output: Product: Laptop Qty: 003 Price: $899.99 Total: $2699.97 Use %s for the string, %03d for the quantity (zero-padded to 3 digits), and %.2f for both price values. Make sure each piece of information appears on its own line.
Expected Output:
Product: Laptop Qty: 003 Price: $899.99 Total: $2699.97
Topics:
Printing
Code Editor
1
Tab to indent ยท Ctrl+Enter to run ยท Ctrl+Space to expand shortcuts (p, fori)
Your Output
Run your code to see the output here...
Test Cases
Run your code to see test case results.