|
|
@ -54,14 +54,14 @@ char *to_string(int number) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
unsigned int power(unsigned int b, unsigned int n){ |
|
|
|
if(b==0&&n==0) return 0; |
|
|
|
else if(b>=1&&n==0) return 1; |
|
|
|
unsigned int power(unsigned int base, unsigned int exponent){ |
|
|
|
if(base==0&&exponent==0) return 0; |
|
|
|
else if(base>=1&&exponent==0) return 1; |
|
|
|
else{ |
|
|
|
unsigned int result = 1, ctr = 0; |
|
|
|
while(ctr<n){ |
|
|
|
result *= b; |
|
|
|
++ctr; |
|
|
|
unsigned int result = 1, counter = 0; |
|
|
|
while(counter<exponent){ |
|
|
|
result *= base; |
|
|
|
++counter; |
|
|
|
} |
|
|
|
return result; |
|
|
|
} |
|
|
|