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  >  Interview Questions  >  Programming  >  C

 Print  |  
Question:  C if condition Puzzle

Answer: What's the "condition" so that the following code
snippet prints both HelloWorld !

if "condition"
printf ("Hello");
else
printf("World");


September 09, 2008 21:36:28 #6
 dutta_sudipta   Member Since: January 2008    Total Comments: 2 

RE: C if condition Puzzle
 
Is it like this?

void main()
{
 int a=2;
 while(a--)
 if(a)
  printf("Hello ");
 else
  printf("World!");
}
     

 

Back To Question