โ 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:
1
22
333
(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
Topics:
Printing
Code Editor
1
Tab to indent ยท Ctrl+Enter to run ยท 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.