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
Why c is procedure oriented?
What is c language and why we use it?
How #define works?
What is array within structure?
What is structure pointer in c?
Explain how are 16- and 32-bit numbers stored?
If the size of int data type is two bytes, what is the range of signed int data type?
Why is c platform dependent?
What is meant by type casting?
When c language was developed?
about c language
What is the use of linkage in c language?
Write a program to reverse a string.
write a C program: To recognize date of any format even formats like "feb-02-2003","02-february-2003",mm/dd/yy, dd/mm/yy and display it as mm/dd/yy.
Differentiate between calloc and malloc.