calculate (x^y)%z without pow();
------------------------------
the question here is how we can reduce the complexity... if we compute the x^y by normal method the complexity is O(y)... to reduce the complexity we can use binary weighted power computation method in which complexity is O(logy)..
ans=1;
square=x;
if(y==0)
return 1;
while(y!=0)
{
if(y%2)
ans=ans*square;
square=(square*square)%z;
y=y/2;
if(ans>z)
ans=ans%z;
}
return ans;