Question
If each of the following printf statements was part of a complete program, what would it print?
a. printf("The answer is %10.1f ",1.2345);
b. #define QUOTE "Hopefully this will help!"
...
printf("/%10.5s/ ",QUOTE);
c. printf("x = %010d ",43);
d. printf("%c",'x4d');
Question 2
Write a single scanf statement that could be used to enter both a person's first and last name.
Question 3
Code conversion specifications for each of the following:
a. a floating point number with a field width of 12 and 5 significant digits
b. a long integer in hexadecimal format
c. an integer with leading zeros instead of leading spaces
d. a short unsigned integer
Question 4
Write a preprocessor define for the shipping charge on one box of freight (assume it is 2.75). Write a C statement that uses this define to calculate the total freight charge for the number of boxes stored in box_cnt, and place the result in tot_shp_cost.
Solution Preview
This material may consist of step-by-step explanations on how to solve a problem or examples of proper writing, including the use of citations, references, bibliographies, and formatting. This material is made available for the sole purpose of studying and learning - misuse is strictly forbidden.
Question 1If each of the following printf statements was part of a complete program, what would it print?
a. printf("The answer is %10.1f ",1.2345);
The answer is 1.2
b. #define QUOTE "Hopefully this will help!"
...
printf("/%10.5s/ ",QUOTE);
/ Hopef/
c. printf("x = %010d ",43);
x = 0000000043
d. printf("%c",'\x4d');
M...