Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Managing Input and Output Operations 107 assigning it to many variable. (f) The specification particular character. may be used in scanf to terminate reading
Managing Input and Output Operations 107 assigning it to many variable. (f) The specification particular character. may be used in scanf to terminate reading at the encounter of a decimal places. (g) The specification %[] is used for reading strings that contain (h) By default, the real numbers are printed with a precision of (i) To print the data left-justified, we must use (j) The specifier in the field specification. prints floating-point values in the scientific notation. 4.3 Distinguish between the following pairs: (a) getchar and scanf functions. (b) %s and %c specifications for reading. (c) %s and %[] specifications for reading. (d) %g and %f specification for printing. (e) %f and %e specifications for printing. 4.4 Write scanf statements to read the following data lists: (a) 78 B 45 (c) 15-10-2002 (b) 123 1.23 45A (d) 10 TRUE 20 4.5 State the outputs produced by the following printf statements. (a) printf ("%d %c%f", 10, 'x', 1.23); (b) printf ("%d %c %4.2f", 1234,, 'x', 1.23); (c) printf ("%d\t%4.2f", 1234, 456); (d) printf ("\"%08.2f\"", 123.4); (e) printf ("%d %d %d", 10, 20); For questions 4.6 to 4.10 assume that the following declarations have been made in the program: int year, count%;B float amount, price%3 char code, city [10]; double root%3 4.6 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( "%f", root); (e) scanf("%c %d %ld", *code, &count, Root); 4.7 What will be the values stored in the variables year and code when the data 1988, x is keyed in as a response to the following statements: (a) scanf("%d %c", &year, &code); (b) scanf("%c %d", &year, &code); (c) scanf("%d %c", &code, &year); (d) scanf("%s %c", &year, &code); 4.8 The variables count, price, and city have the following values: count
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started