Friday, 8 February 2013

12

What is the following function doing?(Mathematical Expression)

int foo(int x, int n)
{
int val = 1;
if (n > 0)
{
if (n % 2 == 1)
val *= x;
val *= foo(x * x, n / 2);
}
return val;
}
Join me on Facebook