@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
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---