Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

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


Please Help Members By Posting Answers For Below Questions

In C programming, how do you insert quote characters (‘ and “) into the output screen?

1477


What is scope of variable in c?

991


How to write a program for machine which is connected with server for that server automatically wants to catch the time for user of that machine?

2039


What are the different types of C instructions?

1245


How to delete a node from linked list w/o using collectons?

2722


What does a pointer variable always consist of?

1041


How to implement a packet in C

2831


What is the difference between exit() and _exit() function?

992


Is a house a shell structure?

1108


What is void pointers in c?

957


What is c language and why we use it?

1003


What is the purpose of & in scanf?

1009


I need a sort of an approximate strcmp routine?

986


In a header file whether functions are declared or defined?

1078


Differentiate abs() function from fabs() function.

962