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 05:29:06 #5
 coolquasar   Member Since: September 2008    Total Comments: 4 

RE: C if condition Puzzle
 

This will do...

#include<stdio.h>
main()
{
if (!fork())
printf ("Hello");
else
printf("World");
}

     

 

Back To Question