See reply at the bottom....

-----Original Message-----
From: vasanthan [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, December 15, 2004 9:29 PM
To: [EMAIL PROTECTED]
Subject: (PT) doubt :




 
dear friends,
        last week  i attended  an innerview, i was  asked  a question
regarding if-else statment please  answer  for this


if(condition)
printf("hello");
else
printf("world");


wat should be  the condition to print 
hello world ie, condition to execute both if& else statment


vasanth

---------------------------------------------------------------------------
Dear Vasanth,

Replace <condition> of IF statement with '!printf("hello")' ie, your code
should look like:

If(!printf("hello"))
        printf("hello");
Else
        printf("world");

As printf function returns number of characters printed on the console, the
if condition here becomes FALSE because of the negation operator and thus
the else statement is executed. Thus the out put is what is required.


Manav Gupta,
(93128 40512)

IF YOU HAVE AN APPLE AND I HAVE AN APPLE AND  IF WE EXCHANGE THEM WE STILL
HAVE ONE APPLE EACH. 

IF YOU HAVE AN IDEA AND I HAVE AN IDEA AND IF WE EXCHANGE THEM WE HAVE TWO
IDEAS EACH.







To unsubscribe : [EMAIL PROTECTED]

 
Yahoo! Groups Links



 











------------------------ Yahoo! Groups Sponsor --------------------~--> 
Make a clean sweep of pop-up ads. Yahoo! Companion Toolbar.
Now with Pop-Up Blocker. Get it for free!
http://us.click.yahoo.com/L5YrjA/eSIIAA/yQLSAA/EbFolB/TM
--------------------------------------------------------------------~-> 

To unsubscribe : [EMAIL PROTECTED]

 
Yahoo! Groups Links

<*> To reply to this message, go to:
    
http://groups.yahoo.com/group/Programmers-Town/post?act=reply&messageNum=4567
    Please do not reply to this message via email. More information here:
    http://help.yahoo.com/help/us/groups/messages/messages-23.html

<*> To visit your group on the web, go to:  
    http://groups.yahoo.com/group/Programmers-Town/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 



Reply via email to