Question: Unlike integer numbers, the field width of real numbers is not to be specified and therefore scanf reads real numbers using the simple specification %f

Unlike integer numbers, the field width of real numbers is not to be specified and therefore scanf reads real numbers using the simple specification %f for both the notations, namely, decimal point notation and exponential notation. For example, the statement scanf("%f %f %f", &x, &y, &z): with the input data 475.89 43.21E-1 678 will assign the value 475.89 to x, 4.321 to y, and 678.0 to z. The input field specifications may be separated by any arbitrary blank spaces. If the number to be read is of double type, then the specification should be % If instead of simple %f. A number may be skipped using %*f specification. Reading of real numbers (in both decimal point and exponential notation) is illustrated in Fig. 1.80
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
