1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

puzzle in C

Discussion in 'C' started by vignesh1988i, Sep 22, 2009.

  1. vignesh1988i

    vignesh1988i Banned

    Joined:
    Sep 19, 2009
    Messages:
    72
    Likes Received:
    0
    Trophy Points:
    0
    Location:
    Chennai
    PUZZLE IN C!!!!!

    write a C/C++ program to say whether a one number is equal to another or not without using RELATIONAL OPERATORS and ARTHMETIC OPERATORS????????:)
     
  2. SaswatPadhi

    SaswatPadhi ~ Б0ЯИ Τ0 С0δЭ ~

    Joined:
    May 5, 2009
    Messages:
    1,343
    Likes Received:
    55
    Trophy Points:
    0
    Occupation:
    STUDENT !
    Location:
    Orissa, INDIA
    Home Page:
    That's simple.

    A [XOR] B = 0 if A == B
    A [XOR] B != 0 if A != B

    Code:
    if(A^B) {printf("%d != %d\n",A,B);}
    else      {printf("%d == %d\n",A,B);}
    
     
  3. vignesh1988i

    vignesh1988i Banned

    Joined:
    Sep 19, 2009
    Messages:
    72
    Likes Received:
    0
    Trophy Points:
    0
    Location:
    Chennai
    ya... you are right..... good keep it up!!!!!!
     

Share This Page