008# puzzle on c
By dholey
@dholey (1383)
India
5 responses
@kingadnan (1538)
• Pakistan
17 Feb 07
yeah! nice its a common sense there is a if loop, so there result is FALSE because there is a!
1 person likes this
@kingadnan (1538)
• Pakistan
27 Feb 07
sorry dholey uncle it was a typing mistake there is a condition of if, and if my answer is wrong, sorry, i don't know C language.
@nihalnihal (660)
• India
8 Feb 07
FALSE. When comparing, 0.9 is taken as a double instead of float so they are not equal. But according to this comparison, it would always print FALSE... If the comparison was for equality(==) then it would print TRUE if 0.9 was casted into float data type. I don't have a compiler in my comp, so I am not able to compile it and see the output..Am I right?
@nihalnihal (660)
• India
8 Feb 07
Hey Buddy! I don't ve a compiler! what's the output? I would really like to know..
@jayanthiinba (245)
• India
6 Feb 07
FALSE is the output.
cuz, "a" is of float datatype, initialized to 0.9
but, in loop, we r checking whether a
@senthilp_1985 (30)
• India
9 Feb 07
Hi
Output is obviously true as the condition get satisfied. I also verified in TC compiler. But as you told in some compilers even though we assign a=.9 when it comes to the condition it compares it with 0.899999 up to six mantissa. So 0.899999
@chhaganbhujbad (263)
• United States
8 Feb 07
I dunno...
I probably will have to put it in the webpage hyperlink and find out if it works....