int main(){
float f=8.0;
if(f==8.0)
printf("good");
else
printf("bad");
}
what is the answere and explain it?
Answer Posted / 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 |
Post New Answer View All Answers
In C programming, how do you insert quote characters (‘ and “) into the output screen?
What is scope of variable in c?
How to write a program for machine which is connected with server for that server automatically wants to catch the time for user of that machine?
What are the different types of C instructions?
How to delete a node from linked list w/o using collectons?
What does a pointer variable always consist of?
How to implement a packet in C
What is the difference between exit() and _exit() function?
Is a house a shell structure?
What is void pointers in c?
What is c language and why we use it?
What is the purpose of & in scanf?
I need a sort of an approximate strcmp routine?
In a header file whether functions are declared or defined?
Differentiate abs() function from fabs() function.