This chapter shows how to use
to format values.
This is an alternative to the formatting methods of the previous chapter.
printf() you have control over how values are printed.
You can ask for this:
The "%8.2f" says to use 8 spaces with two of them for the decimal fraction. The "%n" means newline. Without formatting you get
This chapter is optional. Future chapters do not depend on it, so you can safely skip it. However, your programs will produce better looking output if you use number formatting.
The material in this chapter is not tested in AP Computer Science.
How would you like to see this number displayed:
Some choices are: