@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 <srn...@gmail.com> 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 <atul.a...@gmail.com> 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 < >> virmanisadi...@gmail.com> wrote: >> >>> @priya..wht if a=b=0 ? or a=b= 1000 0000 >>> >>> On Sat, Aug 20, 2011 at 11:33 PM, priya ramesh < >>> love.for.programm...@gmail.com> 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 algogeeks@googlegroups.com. >>>> To unsubscribe from this group, send email to >>>> algogeeks+unsubscr...@googlegroups.com. >>>> 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 algogeeks@googlegroups.com. >>> To unsubscribe from this group, send email to >>> algogeeks+unsubscr...@googlegroups.com. >>> 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 algogeeks@googlegroups.com. >> To unsubscribe from this group, send email to >> algogeeks+unsubscr...@googlegroups.com. >> 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 algogeeks@googlegroups.com. > To unsubscribe from this group, send email to > algogeeks+unsubscr...@googlegroups.com. > 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 algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.