Hello,
I have the following code to print the value of a float with leading/padded zero's.
My desired output is:
PRINT - INTEGER : 01234 and FLOAT : 00123.00003456
The current output upon executing the below code is:
PRINT - INTEGER : 01234 and FLOAT : 123.34559631
Code:
#include<stdlib.h>
#include<stdio.h>
int main()
{
int num_int = 1234;
float num_flt = 123.3456;
fprintf(stdout, " PRINT - INTEGER : %05d and FLOAT : %05.08f \n", num_int, num_flt);
return(0);
}
Can you please let me know how to format the float to yield the desired result. Should i convert it to a string to achieve this?
Any suggestions/advice is deeply appreciated.
Thank you.