Task

Express a number in decimal as a fixed-length string with leading zeros.



For example, the number   7.125   could be expressed as   00007.125.




 
:- module formatted_numeric_output.
:- interface.
:- import_module io.
 
:- pred main(io::di, io::uo) is det.
 
:- implementation.
:- import_module list, string.
 
main(!IO) :-
    io.format("%09.3f\n", [f(7.125)], !IO).
 