A market stall charges 6 for each item. A customer buys 4 items and receives a discount of 3 from the whole purchase. Calculate the receipt rather than putting the finished answer directly into the print call.
The starter supplies price, quantity, and discount, plus a print call that reads total. Its temporary addition uses all three values but gives the wrong receipt total, 13. Replace that expression while keeping the program runnable.
total with an expression using price, quantity, and discount to calculate the purchase total after the discount.Edit main.c, press Run, and check for Total: 21. Then Submit. Multiplication happens before subtraction, so calculate the cost of all four items before subtracting the one discount.
The check compares the receipt text, not the expression. Make sure your calculation uses the supplied variables; writing 21 directly would skip the practice.
Compute price * quantity - discount and use %d to print the integer.