0

How to centralized the output on C language without spamming \t or \n?

C languange

11th Nov 2020, 3:50 AM
Orijuela, Rhay Steven V.
Orijuela, Rhay Steven V. - avatar
2 Answers
+ 2
Use a number to indicate the width that you want the output to take. If the number is positive the output will be right justified in the width you gave, if it's negative the output will be left justified. EXAMPLE: int x=0, y=1; printf("%5d%5d\n", x, y); printf("%-5d%-5d\n", x, y); OUTPUT: 0 1 0 1
11th Nov 2020, 10:08 AM
Davide
Davide - avatar