I solved it using the last code and adding these lines:
int d_num = (int) num;
float frac = num - d_num;
int frac1 = frac * 100;
sprintf(str, "%d.%0.2d\n", d_num, frac1);
I refered to here
I solved it using the last code and adding these lines:
int d_num = (int) num;
float frac = num - d_num;
int frac1 = frac * 100;
sprintf(str, "%d.%0.2d\n", d_num, frac1);
I refered to here