I need help.
I need to create a recursive function that receives a "n" number and returns "n/2" without dividing.
Edit :
This is what I wrote, but it works only if after dividing it will still be a decimal number and not a float, that's why I asked.
int recursive(int a, int b)
{
if ( a == (0.5 * b) )
return a;
return recursive(a-1, b);
}
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…