0
Float a=0.7; if(a<0.7) print (yes) else (no)
what will be output? A)yes B)No C)YesNo And why?
2 Respostas
+ 6
because a is 0.69999999998 in it's floating representation.
When you assign a=0.7 in memory 0.7 cannot be represented in double precision as you would have thought.
So the comparison between float and double leads to type promotion and in that case a is less than 0.7 which is double.
- 2
is this a question? print isnt a thing in cpp and the syntax is wrong for half of it but assuming its correct i still dont understand the question.