C Programming :: Variables & Data Types - Discussion
Home > C Programming > Variables & Data Types > MCQs Questions Discussion
23 / 51
What is the output of the following program?
#include<stdio.h>
void main()
{
float a= 0.7;
if (a<0.7)
printf("C");
else
printf ("C++");
}
#include<stdio.h>
void main()
{
float a= 0.7;
if (a<0.7)
printf("C");
else
printf ("C++");
}
AC
BC++
CError
DNone of the above
Answer: Option (Login/Signup)
Show Explanation
Asked In ::
STEP-BY-STEP
This is because of rounding the value of variable a.
i.e.
a=0.7 is rounded to
=0.699999988
And, the constant 0.7 is as
=0.69999999999
so a<0.7 is true so it prints C.
Read Full Answer
Report Error
Please Login First Click Here