← Back to Printing
Question 10
Product with Float
Product with Float
Create an int variable with the value 5 and a float variable with the value 2.5f. Multiply them together and use cout with setprecision to display the output shown in Expected Output. Use fixed andsetprecision(2)for the float values. Remember to include<iomanip>. The result of multiplying an int and a float is a float.
Expected Output:
5 x 2.50 = 12.50= newline. No newline after the last line.
Hints4 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 (cout, fori)
Your Output
Run your code to see the output here...
Test Cases
Run your code to see test case results.