1 2 3 4 5 6 7 8 9 10
int pow(int base, int exp) { if (exp < 0) return 0; if (!exp) return 1; int ret = base; for (int i = 1; i < exp; i++) ret *= base; return ret; }