Sail E0 Webinar
Question

What will be output of the following?

#include<stdio.h>
int main()
{
float a=0.7;
if(a < 0.7)
printf("Cn");
else
printf("C++n");
return 0;
}


Options:
A .  C
B .  C++
C .  Error
D .  None of the above
Answer: Option A

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



Was this answer helpful ?
Next Question

Submit Solution

Your email address will not be published. Required fields are marked *

Latest Videos

Latest Test Papers