pow function

来源:互联网 发布:复杂网络理论及应用 编辑:程序博客网 时间:2024/05/05 05:16

Signiture:

int pow(int, int);

int myPow(int x, int n){    if(n == 1)        return x;    return x * myPow(x, n-1);}


Exponentiation by squaring is a more efficient way.

原创粉丝点击