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;
Sorry but lets start with a quotient of 1
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;
}
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
hey there i did play around with bit shifting sometime ago and was able to
do that.. but yeah i guess the one i posted is a bit different from what i
actually did before and is not applicable here. here is what we can do
int funcNoDiv(int divisor, int dividend)
{
if(divisor == dividend)
{
in the previous logic, dont forget to address a negative divisor, dividend
and alternative cases like those... it shud be pretty easy
On 10/8/07, Vinay Chilakamarri [EMAIL PROTECTED] wrote:
hey there i did play around with bit shifting sometime ago and was able to
do that.. but yeah i guess