← Back to Pointers
Question 429
Discount a double Price Through Its Pointer
Discount a double Price Through Its Pointer
Read one price (a decimal number) from input, point adoublepointer namedppat it, print the original price, then apply a 10 percent discount by writing throughpp(*pp = *pp * 0.9;). Print both numbers with exactly two decimal places using%.2f. Input: one decimal number. For the input40.00print exactly the output shown in Expected Output.
Expected Output:
Original: 40.00 Discounted: 36.00
= newline. The output ends with a newline — print one after the last line.
Hints3 available
Sign in to use hintsTopics:
Pointers
1
Tab to indent (Esc then Tab to move on) · Ctrl+Enter to run · Shift+Alt+F to format · 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.