1. We have moved from vBulletin to XenForo and you are viewing the site in the middle of the move. Though the functional aspect of everything is working fine, we are still working on other changes including the new design on Xenforo.
    Dismiss Notice

Hello World in C

Discussion in 'C' started by shabbir, Jul 6, 2005.

  1. shabbir

    shabbir Administrator Staff Member

    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
     
  2. go4expert

    go4expert Moderator

    How much twist can be impared with just Hello World
     
  3. coderzone

    coderzone Super Moderator

    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
     
  4. coderzone

    coderzone Super Moderator

    very true :)
     

Share This Page