If a,b are not equal then this statement will always return true status as a^b=true so true bit-wise or-ed with anyone will return true.
On Sun, Aug 21, 2011 at 10:38 AM, SHUBHAM BANSAL <[email protected]>wrote: > ((a^b) | ((a&b)<<1)) > sorry tht was bitwise or..by mistak i hd wrote logicl or > SHUBHAM BANSAL > COMP DEPT.. > NIT KKr > > > > On Sun, Aug 21, 2011 at 9:30 AM, Sanjay Rajpal <[email protected]> wrote: > >> Yes if a or b are non zero, the result is always 1. >> Sanju >> :) >> >> >> >> On Sat, Aug 20, 2011 at 8:57 PM, Naman Mahor <[email protected]>wrote: >> >>> @sanjay >>> assume that the value of a=0,b=0; >>> so a^b=0 >>> and (a&b)<<1 =0 >>> so answer will zero. >>> so the result will not always 1. it can be 0 or 1 depends on the value of >>> a n b. >>> >>> >>> On Sun, Aug 21, 2011 at 12:12 AM, Sanjay Rajpal <[email protected]>wrote: >>> >>>> || 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. >>>> >>> >>> -- >>> 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. > -- With regards ............ Puneet Chawla Computer Engineering Student NIT Kurukshetra -- 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.
