=.7because the if condition not satisfied na The output will be this=> "b output : b>=.7because as first if cond doesnt satisfy it doesnt go to second if cond & else part, so the control goes to ou. output and why?main(){ float a=.5,b=.7; if(b the output is printf("b=.5"); the out put is b>=.7because the if condition not satisfied na The output will be this=> "b output : b>=.7because as first if cond doesnt satisfy it doesnt go to second if cond & else part, so the control goes to ou . 6 members have posted answers.">
GeekInterview.com
   Home |  Tech FAQ  |   Interview Questions |  Placement Papers |  Tech Articles |  Learn |  Freelance Projects |  Online Testing |  Geeks Talk |  Job Postings |  Knowledge Base | Site Search |  Add/Ask Question

GeekInterview.com  >  Tech FAQs  >  OOPS
Go To First  |  Previous Question  |  Next Question 
 OOPS  |  Question 222 of 255    Print  
output and why?

main(){
float a=.5,b=.7;
if(b<.7)
if(a<.5)
printf("b<.7 and a<.5");
else
printf("b<.7 and a>=.5");
else
printf("b>=.7");
}

  
Total Answers and Comments: 6 Last Update: February 06, 2007     Asked by: vaasu 
  
 Sponsored Links

 
 Best Rated Answer

No best answer available. Please pick the good answer available or submit your answer.
May 25, 2006 00:49:05   #1  
Umme Zakira        

RE: output and why?main(){ float a...
the output is printf("b<.7 and a>=.5");
 
Is this answer useful? Yes | No
May 25, 2006 06:14:53   #2  
Rajan        

RE: output and why?main(){ float a...
the out put is b>=.7because the if condition not satisfied na
 
Is this answer useful? Yes | No
May 30, 2006 10:42:31   #3  
Gajanan        

RE: output and why?main(){ float a...
The output will be this=> "b<.7 and a<.5"because the fractional values are not stored as it is into the variables...they will be stored as an approximate values.see here a=.5 assigned which will be stored as .99999996where as the variable 'a' is compaired with constant .5 which is a constant and stored as it is!!!obiviousaly then a<.5.the same applicable for .7 and 'b'so the answer is "b<.7 and a<.5"
 
Is this answer useful? Yes | No
June 01, 2006 07:53:50   #4  
lipi chandran        

RE: output and why?main(){ float a...

output : b>=.7

because as first if cond doesnt satisfy it doesnt go to second if cond & else part, so the control goes to outer else part.


 
Is this answer useful? Yes | No
June 03, 2006 03:59:15   #5  
Suvarna        

RE: output and why?main(){ float a...
output = a<.7 and b<.5 as float values are stored less then the actually are.
 
Is this answer useful? Yes | No
February 06, 2007 02:13:06   #6  
Akash        

RE: output and why?main(){ float a...
The output of the above programme will be b<0.7 and a>=0.5 .7 is not stored as 0.7 ie it is stired to some value which is slightly less that 0.7 so the control will not work as expected [this is the only excception i guess for floating point nos]
 
Is this answer useful? Yes | No


 
Go To Top


 Sponsored Links

 




About Us  |   Privacy Policy  |   Terms and Conditions  |   Contact  |   Site Map  |   Add Question  |   Propose Category  |   RSS Feeds  |   Articles Sitemap  |   Site Updates  |   Add Resource

Copyright © 2005 - 2008 GeekInterview.com. All Rights Reserved
Page copy protected against web site content infringement by Copyscape