Yes can u please explain the algorithm...

On Oct 7, 11:55 pm, "Ajinkya Kale" <[EMAIL PROTECTED]> wrote:
> @Vinay : Can you please explain the algorithm of your code..
>
> On 10/7/07, Vinay Chilakamarri <[EMAIL PROTECTED]> wrote:
>
>
>
>
>
>
>
> > How about recursive way:
>
> > int funcNoDiv(int divisor, int dividend)
> > {
> > //base case
> >  if(divisor == dividend)
> >   {
> >      return 1;
> >   }
>
> >   else if( divisor > dividend)
> >   {
> >       return 0;
> >   }
>
> >   else // divisor < dividend
> >   {
> >      while(divisor <= dividend)
> >     {
> >         divisor = divisor << 1;
> >          remainder = remainder << 1;
> >      }
>
> >   //now divisor > dividend
>
> >    divisor = divisor >> 1;
> >    dividend = dividend >> 1;
> >    quotient = quotient + funcNoDiv(dividend - divisor, tempdivisor)
> > }
> > On 10/7/07, megha <[EMAIL PROTECTED]> wrote:
>
> > > Hi all,
>
> > > I am looking for the program/algorithm to implement division without
> > > using divide operator?
>
> > > Any idea?
>
> > > Thanks
>
> --
> Ciao,
> Ajinkya- Hide quoted text -
>
> - Show quoted text -


--~--~---------~--~----~------------~-------~--~----~
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 [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/algogeeks
-~----------~----~----~----~------~----~------~--~---

Reply via email to