+ 5
How to add Before a float 0 and more?
I got to class Today and the Professor asked us to Code something. There is a float number 5.5 but in output should be 005.500 So i tried it with %03f but it only gives me 005.5? Can someone explain the way How the Logic in %f works?
5 odpowiedzi
+ 5
Thank you very much ~ swim ~
+ 5
Now i got it. Because there are 7 things, 6 digits and the one space where the "." (dot) is!!!
Thank you so much!
+ 3
And why exactly 7? Because you Start at 0 and have 6 numbers? rodwynnejones
+ 2
float a = 5.5;
printf("%07.3f", a);
here:-http://www.cplusplus.com/reference/cstdio/printf/