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

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