Skip to content

Instantly share code, notes, and snippets.

@lzzy12
Last active November 12, 2018 12:43
Show Gist options
  • Save lzzy12/b0b9c4531669b97f0acc3b3d6ec7c065 to your computer and use it in GitHub Desktop.
Save lzzy12/b0b9c4531669b97f0acc3b3d6ec7c065 to your computer and use it in GitHub Desktop.
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