35657

Untitled

Dec 16th, 2023
609
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.18 KB | None | 0 0
  1.  
  2.  
  3. #include <iostream>
  4.  
  5.  
  6. using namespace std;
  7.  
  8. int power(int a, int n) {
  9.     if (n == 1) {
  10.         return a;
  11.     }
  12.     return a * power(a, n - 1);
  13. }
  14.  
  15. int main() {
  16.     cout << power(3, 4);
  17.  
  18. }
Advertisement
Add Comment
Please, Sign In to add comment