在int前面添加小数点的问题

So I am trying to add a decimal point in front of a whole in (10) The issue is I'm trying to use sprintf(); but it seems to not be working for me :(.

Code:

sprintf(".",($percentamount));

Let me know what I am doing wrong thanks!

I have already tried "%.f"

if i understand you correctly you will take $percentamount variable which have to contain 10 as its value and just put '.' in front of it to make string '0.1' out of it - is it right? If yes than you could take 10 as digit and place it within a string as follows:

sprintf('.%d', 10); // %d stands for digit and means digit should be your second parameter

if you want to have 10 as string input you could write it as follows:

sprintf('.%s', '10');

if it is not the solution you looking for please describe it better and i'll try to help