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 |
write a program to rearrange the array such way that all even elements should come first and next come odd
What is a pointer?
Finding first/last occurrence of a character in a string without using strchr( ) /strrchr( ) function.
can you change name of main()?how?
Explain which of the following operators is incorrect and why? ( >=, <=, <>, ==)
related to rdbms query .
wats SIZE_T meant for?
Suggesting that there can be 62 seconds in a minute?
how can i print "hello"
write a function which accept two numbers from main() and interchange them using pointers?
how can use subset in c program and give more example
What is double pointer?