Programming Exercises
Write a program that asks for your first name, your last name, and then prints the names in the format last, first.
Write a program that requests your first name and does the following with it:
Prints it enclosed in double quotation marks
Prints it in a field 20 characters wide, with the whole field in quotes
Prints it at the left end of a field 20 characters wide, with the whole field enclosed in quotes
Prints it in a field three characters wider than the name
Write a program that reads in a floating-point number and prints it first in decimal-point notation and then in exponential notation. Have the output use the following formats (the number of digits shown in the exponent may be different for your system):
The input is 21.3 ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access