Solution for Exercise 13-15
ex1315
#include <stdio.h> int main() { printf("%-6s %-10s\n","George","Washington"); printf("%-6s %-10s\n","John","Adams"); printf("%-6s %-10s\n","Thomas","Jefferson"); printf("%-6s %-10s\n","James","Madison"); return(0); }
Output
George Washington
John Adams
Thomas Jefferson
James Madison
Notes
* The conversion characters %-6s
and %-10s
left align the text with a space between them (look at the formatting string at Line 14). The longest first name is six letters long (two of them), and Washington
is the longest last name at 10 characters.
Copyright © 1997-2024 by QPBC.
All rights reserved