Hello World in C

Go4Expert Founder
6Jul2005,12:31   #1
shabbir's Avatar
Code:
void main()
{
  if(X)
  {
    printf("Hello");
  }
  else
  {
    printf(" World");
  }
}
what to be placed in the place of X inorder to get the o/p ??? Hello World

Thanks
Shabbir Bhimani
Team Leader
6Jul2005,13:42   #2
go4expert's Avatar
How much twist can be impared with just Hello World
Team Leader
6Jul2005,13:43   #3
coderzone's Avatar
What I can think of is

X = !printf("Hello")

so the program becomes
Code:
void main()
{
  if(!printf("Hello"))
  {
    printf("Hello");
  }
  else
  {
    printf(" World");
  }
}
As printf returns no of characters it prints out so the output would become Hello World as desired
Team Leader
6Jul2005,13:51   #4
coderzone's Avatar
Quote:
Originally Posted by go4expert
How much twist can be impared with just Hello World
very true