I’m working through “Julia Bit-By-Bit” and following is an exercise from chapter 2:
You are required to print the values of the integer variables b , h and n . Write a
statement which prints b with its rightmost digit in column 10, h with its rightmost
digit in column 20 and n with its rightmost digit in column 30.
I’ve tried many different ways, e.g.:
b = 1
h = 2
n = 3
@printf("%-10d\n%-20d\n%-30d\n", b, h, n)
but I always end up with something like:
when what I think I want (if I’m reading the question correctly) is more like:
1 | 2 |
where | signifies the right margin (not printed).
Is this possible using @printf, which is what was covered in this chapter)? Or am I misunderstanding the question?
Thanks for taking the time to help.
P.S Lol, I can’t even get the formatting to work right on the number 3 above, but I hope you get my meaning.