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 |
How can I change the size of the dynamically allocated array?
what is the associativity of bitwise OR operator?
What is storage class?
send me the code of flow chart generator using C-programming language amd this code should calculate the time and space complexity of the given progran and able to generate flowchart according to the given program?
main() { char as[] = "\\0\0"; int i = 0; do{ switch( as[i++]) {case '\\' : printf("A"); break; case 0 : printf("B"); break; default : printf("C"); break; }} while(i<3); }
4 Answers Vector, Vector India,
Here is a good puzzle: how do you write a program which produces its own source code as output?
Explain what is the best way to comment out a section of code that contains comments?
How important is structure in life?
What is the right type to use for boolean values in c? Is there a standard type?
Write program to remove duplicate in an array?
write a program to display numbers from 1 to 10 and 10 to 1?
GIven a sequence of characters. How will you convert the lower case characters to upper case characters. ( Try using bit vector - sol given in the C lib -> typec.h)