solved the problem , then looked for editoral , found following code
float power(float x, int y)
{
float temp;
if( y == 0)
return 1;
temp = power(x, y/2);
if (y%2 == 0)
return temptemp;
else
{
if(y > 0)
return xtemptemp;
else
return (temptemp)/x;
}
}
in this when y is even (if statement), which case is handeled by if(y<0) and how.
if power i.e. y could be negative, why don’t it considers it in first most if when y is even