0

I'm trying to display float number like this:

0.64 0 1 0.64 0.0625 1 0.64 0.125 1 0.64 0.1875 1 0.64 0.25 1 0.64 0.3125 2 0.64 0.375 2 0.64 0.4375 2 0.64 0.5 2 

i know that i need to use %g but how can the spaces change ? thanks

3
  • add "\t" for tab Commented Dec 6, 2017 at 17:31
  • 1
    @Ora That's not going to work when the length of the shortest printed number is 8 or more chars less than the length of the longest printed number. Commented Dec 6, 2017 at 17:32
  • Try the format specifier %12g, or to ensure a space afterwards, reduce the "width" part of the specifier by one and add an explicit space, like: %11g %11g %d. Commented Dec 6, 2017 at 17:53

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.