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...

main()
{
float a=8.8;
double b=8.8;
if(a==b)
printf("Equal");
else
printf("not equal");
getch();
}
what is the output?
with reason

Answer Posted / sandy0103

I am NOT sure, if it is something to do with the compiler,
rather it is something to do with the precision. Float has
got single precision and double is double precision. This
precision difference will get different value when you see
raw value. In another sense, I tried debugging the program
in VS2005 debugger, and if we monitor the value using
watch, you can see for float it is taking the value
as "8.8000002" and for double, it is taking value as "
8.8000000000000007". And hence the precision plays a role
here.

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Write a program to reverse a linked list in c.

1078


The process of repeatedly running a set of computer instructions until some condition is specifed a) condition b) sequential condition c) global d) iteration

1053


What does %p mean?

1040


Create a structure to specify data on students given below: Roll number, Name, Department, Course, Year of joining Assume that there are not more than 450 students in the college. 1.write a function to print names of all students who joined in a particular year 2.write a function to print the data of a student whose roll number is given

3023


Write the syntax and purpose of a switch statement in C.

1057


Write a code to generate divisors of an integer?

1014


Why malloc is faster than calloc?

1021


What is local and global variable in c?

1142


What is the difference between malloc calloc and realloc in c?

1084


What is the value of c?

1022


What is %s and %d in c?

986


c program to compute AREA under integral

2348


What is an expression?

1013


When we use void main and int main?

1031


How do I create a directory? How do I remove a directory (and its contents)?

1112