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
How can I sort a linked list?
What is the difference between declaring a variable by constant keyword and #define ing that variable?
What is the size of structure pointer in c?
Can we access array using pointer in c language?
Explain the difference between #include "..." And #include <...> In c?
please give me some tips for the placement in the TCS.
pgm to find number of words starting with capital letters in a file(additional memory usage not allowed)(if a word starting with capital also next letter in word is capital cann't be counted twice)
How many levels of indirection in pointers can you have in a single declaration?
is it possible to create your own header files?
How important is structure in life?
What is difference between stdio h and conio h?
What is the use of a ‘ ’ character?
One of the Institutes contains 5 student groups. Every group contains 4 students. Institute wants to store student group’s details in array. Group should contain group member’s details (name and registration number and age), project name, and mark of the group.
What does c value mean?
What is echo in c programming?