int main(){
float f=8.0;
if(f==8.0)
printf("good");
else
printf("bad");
}
what is the answere and explain it?
Answers were Sorted based on User's Feedback
Answer / c++ coder
Answer is "bad"
reason being, that when 8.0 is stored into the float
variable , it is never stored exactly as 8.0 because of
precision. Thus the comparsion will never evaluate to true.
It is always recommended not to do float, double
comparsions like this. :)
Is This Answer Correct ? | 2 Yes | 0 No |
Answer / jayaraj.s
good is the result. because we declare and compare the same
value in the program.so alwaye if condition is true. we no
need to put else condition for these type of comparisions.
Is This Answer Correct ? | 2 Yes | 3 No |
diff between exptected result and requirement?
What is structure of c program?
Is there a way to jump out of a function or functions?
Why is c platform dependent?
What is linear search?
What are external variables in c?
what is structuer?
How can you print HELLO WORLD without using "semicolon"?
write a program to remove duplicate from an ordered char array? in c
what is the stackpointer
What do you mean by Recursion Function?
While compiling a c program,graphics header files are not including in my program..eg: <graphics.h>,what may be the problem...is there any environment settings exists.