Created
April 3, 2024 02:45
-
-
Save Khuirul-Huda/c913cbf40cf32787c1d12e40e0379583 to your computer and use it in GitHub Desktop.
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
#include <iostream> | |
using namespace std; | |
int power(int number, int pow) { | |
if (pow == 0){ | |
return 1; | |
} | |
return number * power(number, pow-1); | |
} | |
int main() { | |
int hasil = power(2,3); // 4 pangkat 3 | |
cout << hasil; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment