Skip to content

Instantly share code, notes, and snippets.

@Khuirul-Huda
Created April 3, 2024 02:45
Show Gist options
  • Save Khuirul-Huda/c913cbf40cf32787c1d12e40e0379583 to your computer and use it in GitHub Desktop.
Save Khuirul-Huda/c913cbf40cf32787c1d12e40e0379583 to your computer and use it in GitHub Desktop.
#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