โ Back to Printing
Question 247
Interpolate with a Format Specifier
Interpolate with a Format Specifier
The variablepriceholds the double 3.5. Using string interpolation, print it as a dollar amount with exactly two decimals: $3.50 Use a:F2format specifier inside the interpolation.
Expected Output:
$3.50
Topics:
Printing
Code Editor
1
Tab to indent ยท Ctrl+Enter to run ยท 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.