Question
#include<stdio.h>
int main()
{
float a=0.7;
if(a < 0.7)
printf("C\n");
else
printf("C++\n");
return 0;
}
What will be the output of the program?
#include<stdio.h>
int main()
{
float a=0.7;
if(a < 0.7)
printf("C\n");
else
printf("C++\n");
return 0;
}
Answer: Option A
#include<stdio.h>
int main()
{
float a=0.7;
printf("%.10f %.10f\n",0.7, a);
return 0;
}
Was this answer helpful ?
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 %.10f\n",0.7, a);
return 0;
}
Output:
0.7000000000 0.6999999881
Was this answer helpful ?
More Questions on This Topic :
Question 6.
The binary equivalent of 5.375 is
....
Question 10.
By default any real number is treated as :
....
Submit Solution