- What happens if an output data item contains
(a) more characters than the specified field width and
(b) fewer characters than the specified field width?
- How are the unrecognized characters within the control string are interpreted in
(a) scanf function; and
(b) printf function? 1. State errors, if any, in the following input statements.
(a) scanf(“%c%f%d”, city, &price, &year);
(b) scanf(“%s%d”, city, amount);
(c) scanf(“%f, %d, &amount, &year);
(d) scanf(n”%f”, root);
(e) scanf(“%c %d %ld”, *code, &count, Root);
- State what (if anything) is wrong with each of the following output statements:
(a) printf(%d 7.2%f, year, amount);
(b) printf(“%-s, %c”n, city, code);
(c) printf(“%f, %d, %s, price, count, city);
(d) printf(“%c%d%fn”, amount, code, year);
- Given the string “WORDPROCESSING”, write a program to read the string from the
terminal and display the same in the following formats:
(a) WORD PROCESSING
(b) WORD
PROCESSING
(c) W.P.
- Write a program to read the following numbers, round them off to the nearest integers and
print out the results in integer form:
35.7 50.21 – 23.73 – 46.45