0

Why %8.5f is usd whn %.5f also dies d same job?

printf("Pi = %8.5f \n", 3.14159); /* Pi = 3.14159 */

7th Sep 2019, 2:52 PM
Maithri Vishnu Hebbar
Maithri Vishnu Hebbar - avatar
1 Resposta
+ 8
While it doesn't matter for that number, to have columns of numbers line up correctly it becomes important. printf("%8.5f\n", 3.14159); printf("%8.5f\n", 13.14159); printf("%8.5f\n", 123.14159); Would display: 3.14159 13.14159 123.14159 Note: 8 is a suggested minimum so the last gets 9.
8th Sep 2019, 12:34 AM
John Wells
John Wells - avatar