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 |
Define a structure to store the record of library. The record must consist of at least following fields: Title, Author, Edition, Price, Publisher, and Category. -Define functions authorSearch ( ), TitleSearch ( ) and CategorySearch ( ) to search a book with respect to author, title and category. [There can be more than one book, written by one author, in one category]
What are types of structure?
Can a pointer point to null?
Why is python slower than c?
How does free() know how many bytes to free?
How to explain the final year project as a fresher please answer with sample project
Is it better to use a macro or a function?
DIFFERNCE BETWEEN THE C++ AND C LANGUAGE?
If a variable is a pointer to a structure, then which operator is used to access data members of the structure through the pointer variable?
What is the process of writing the null pointer?
Draw a flowchart to produce a printed list of all the students over the age of 20 in a class .The input records contains the name and age of students. Assume a sentinel value of 99 for the age field of the trailer record
Explain how can I remove the trailing spaces from a string?