take an number find its binary add all odd bits and even bits seperately now check if the difference is divisible by 3 if yes it is say 6 110 -----> 1+0 - 1 =0 9 1001 -----> 1+0 - 0+1 = 0 12 1100 ------> 1+0 - 1+0 = 0 Arun,
On Fri, Aug 14, 2009 at 1:15 PM, richa gupta <richa.cs...@gmail.com> wrote: > > can we check the divisibility of a given number by 3 withoutusing > operators like '/' or '%'. > I want the efficient solution to this problem .. > > can someone help ?? > -- > Richa Gupta > (IT-BHU,India) > > > > -- Potential is not what U have, its what U think U have!!! It is better to worn out than rust. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---