C Programming :: Basic Concepts - Discussion
33 / 90
To scan float a and double b, which scanf() statement will be used?
Ascanf("%f%f", &a, &b);
Bscanf("%f%Lf', &a, &b);
Cscanf ("%Lf%Lf', &a, &b);
Dscan{ ("%f%lf', &a, &b);
Show Explanation
Option A is incorrect because it will scan both the variables as float.
Option B is incorrect as here variable b will be scanned as long-double type, but we want b to be double type.
Option C is incorrect because here both the variables will be scanned as long-double type.
Option D is incorrect because it should be 'scanf' and not 'scan{', which will create an error. If we correct this then variable a will be scanned as float type and variable b will be scanned as double type.
Asked In ::
We want to scan float a and double b.
Option A is incorrect because it will scan both the variables as float.
Option B is incorrect as here variable b will be scanned as long-double type, but we want b to be double type.
Option C is incorrect because here both the variables will be scanned as long-double type.
Option D is incorrect because it should be 'scanf' and not 'scan{', which will create an error. If we correct this then variable a will be scanned as float type and variable b will be scanned as double type.
Read Full Answer
Report Error
Please Login First Click Here