The answer should be "how are you"
because float & double is not same data type. 
You can use typecasting in order to get "hello"

akash




________________________________
From: Tyler Littlefield <[email protected]>
To: [email protected]
Sent: Friday, 7 August, 2009 8:25:24 PM
Subject: Re: [c-prog] plz solve

  
it's a comparison issue, I think paul sited a link for the two.

----- Original Message ----- 
From: Lori Nagel 
To: c-p...@yahoogroups. com 
Sent: Friday, August 07, 2009 8:39 AM
Subject: Re: [c-prog] plz solve

I ran it on my computer (Linux, gcc compiler pentium 4) and I got 
how are u

apparently in my case double and float is not the same thing. 

____________ _________ _________ __
From: Paul Herring <pauljherring@ gmail.com>
To: c-p...@yahoogroups. com
Sent: Friday, August 7, 2009 10:25:47 AM
Subject: Re: [c-prog] plz solve

On Fri, Aug 7, 2009 at 11:57 AM, Uday Oberio <uday_oberio@ yahoo.co. in> wrote:

> float a=1.1;
> double b=1.1;
> if(a==b)
> printf("hello" );
> else
> printf("how are u ");
>
> now tell me which part will be executed

Either one may be executed.

> and why ?

Because you cannot compare floats for exactness like you're trying to do.

Have a read of <http://docs. sun.com/source/ 806-3568/ ncg_goldberg. html>

[Non-text portions of this message have been removed]





      Yahoo! recommends that you upgrade to the new and safer Internet Explorer 
8. http://downloads.yahoo.com/in/internetexplorer/

[Non-text portions of this message have been removed]

Reply via email to