|| is a short-circuit operator(LOGICAL OR). if first condition is true, then second is not evaluated, only if first is false, second is evaluated.
If a==b, then second condition will evaluate to true, else first condition will be evaluated, which are true here both. So the result is always 1. Sanju :) On Sat, Aug 20, 2011 at 11:37 AM, Atul Modi <[email protected]> wrote: > || is not bitwise or...it is logical or....so it is basically for the two > ops (a^b) being succesful n (a&b)<<1 returning 1 on success....thus the ans. > is 1 i think > > On Sat, Aug 20, 2011 at 11:59 PM, Aditya Virmani <[email protected] > > wrote: > >> @priya..wht if a=b=0 ? or a=b= 1000 0000 >> >> On Sat, Aug 20, 2011 at 11:33 PM, priya ramesh < >> [email protected]> wrote: >> >>> the answer is 1 >>> sum=1 >>> >>> -- >>> You received this message because you are subscribed to the Google Groups >>> "Algorithm Geeks" group. >>> To post to this group, send email to [email protected]. >>> To unsubscribe from this group, send email to >>> [email protected]. >>> For more options, visit this group at >>> http://groups.google.com/group/algogeeks?hl=en. >>> >> >> -- >> You received this message because you are subscribed to the Google Groups >> "Algorithm Geeks" group. >> To post to this group, send email to [email protected]. >> To unsubscribe from this group, send email to >> [email protected]. >> For more options, visit this group at >> http://groups.google.com/group/algogeeks?hl=en. >> > > -- > You received this message because you are subscribed to the Google Groups > "Algorithm Geeks" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]. > For more options, visit this group at > http://groups.google.com/group/algogeeks?hl=en. > -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
