← Back to Printing
Question 22
Subtraction Equation
Subtraction Equation
Create two integer variables with the values 15 and 8. Use oneSystem.out.printf()statement to show a subtraction equation (see Expected Output). Calculate the result by subtracting the second variable from the first, then use printf with%dformat specifiers to display all three numbers in the equation format shown above.
Expected Output:
15 - 8 = 7= newline. The output ends with a newline — print one after the last line.
Hints2 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 (sysout, psvm, fori)
Your Output
Run your code to see the output here...
Test Cases
Run your code to see test case results.