← Back to Printing
Question 175
Right Aligned Numbers
Right Aligned Numbers
A field width in a format specifier right-aligns a value in a column. Using %5d (width 5), print these three numbers each on its own line, right-aligned in a 5-character column (see Expected Output).
(The first line has 4 spaces then 1; the second has 3 spaces then 22; the third has 2 spaces then 333.)Expected Output:
1 22 333
= newline. No newline 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 (p, fori)
Your Output
Run your code to see the output here...
Test Cases
Run your code to see test case results.