Last active
November 12, 2018 12:43
-
-
Save lzzy12/b0b9c4531669b97f0acc3b3d6ec7c065 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
int main(){ | |
float result = 1.0, base; | |
int exponent; | |
cin >> base >> exponent; | |
if(exponent != 0){ | |
while (exponent){ | |
if(exponent > 0) | |
{ | |
result *= base; | |
exponent--; | |
} | |
else { | |
result /= base; | |
exponent++; | |
} | |
} | |
} else result = 1; | |
cout << result; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment