MCQs
printf("%f`setminus`n", sqrt(36.0)); It prints the square root of 36 in the float format(i.e 6.000000).
Declaration Syntax: double sqrt(double x) calculates and return the positive square root of the
given number.
if(a < 0.7) here a is a float variable and 0.7 is a double constant. The float variable a is less than double constant 0.7. Hence the if condition is satisfied and it prints 'C'
#include<stdio.h>int main()
{
float a=0.7;
printf("%.10f %.10fn",0.7, a);
return 0;
}
Output:
0.7000000000 0.6999999881
sizeof(3.14f) here '3.14f' specifies the float data type. Hence size of float is 4 bytes.
sizeof(3.14) here '3.14' specifies the double data type. Hence size of float is 8 bytes.
sizeof(3.14l) here '3.14l' specifies the long double data type. Hence size of float is 10 bytes.
Note: If you run the above program in Linux platform (GCC
Compiler) it will give 4, 8, 12 as output. If you run in Windows
platform (TurboC Compiler) it will give 4, 8, 10 as output. Because, C
is a machine dependent language.