Computer Science, asked by devyadv3592, 1 year ago

What will be the output #include { float f = 0.1; if (f == 0.1) printf("yes\n"); else printf("no\n"); return 0; }?

Answers

Answered by prathamesh1855
5
The output Is NO...............
Answered by lovingheart
7

Answer:

Output will be NO

Explanation:

Here f is a floating point variable where value of 0.1 is assigned.

When this is compared using if loop in the next statement, f==0.1 returns false. The reason is 0.1 is a double value and it does not matches. In order to print yes, the condition must be f==0.1 f, where f indicates the value is typecasted to float. Always we must write ‘f’ next to the value of any floating point number.

Similar questions