I would say that they all take their roots back to the BCPL. We used BCPL to program operating systems for the 6809 processor two decades ago, and it had a writef() function that took arguments like %i2 (equivalent to C %2d ).
C was based on a shortened version of BCPL and inherited a similar mechanism for formatting output, and I'm sure that all other instances picked it up from C after that.
I could be wrong, this will not be the first or last time, but I am sure that it is correct, given what I know about the BCPL language and its origin.
source share