Mahmoud_Hawara

PA07-2

Dec 30th, 2025
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.22 KB | None | 0 0
  1. public class Main {
  2.    
  3.     public static int power(int x, int n) {
  4.         if (n == 0) return 1;
  5.         return x * power(x, n - 1);
  6.     }
  7.    
  8.     public static void main(String[] args) {
  9.         System.out.println(power(5, 3));
  10.     }
  11. }
Advertisement
Add Comment
Please, Sign In to add comment