Created
November 20, 2016 20:37
-
-
Save MohammedRashad/0652999df7bc3002b3b3c242a7273aab to your computer and use it in GitHub Desktop.
calculate the power of any integer
This file contains 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
uint32_t power(uint32_t n,uint32_t m){ | |
if (m == 0) return 1; | |
if (m == 1) return n; | |
return n * power(m - 1); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment