Chapter - 12: Console Input-Output

If we are to display the following output properly aligned which format specifiers would you use.


D
Sections
4
Exercises
Discovery of India         Jawaharlal Nehru    425.50
My Experiments with Truth  Mahatma Gandhi      375.50
Sunny Days                 Sunil Gavaskar      95.50
One More Over              Erapalli Prasanna   85.00

Ans: 

For the first column: %26s
For the second column: %18s
For the third column: %3.2lf


© 2021 Garbage Valuegarbage value logo