printf

Go To Last Post
3 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hello fella freaks, I have a very simple question that is bugging me and I hope someone can help me. how can I use printf to print a interger value occupying 2 places on the screen.

Once again thanks for you help.

Wm.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

printf("%2d",n);

There are plenty of printf format string references to be found on the web like this one.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Or possibly "%02d" if you want 0..9 to appear as "00".."09"