Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class app {
- public static void main(String[] args) {
- var result = power(10,10);
- System.out.println(result);
- }
- public static int power(int base, int exp) {
- if(exp<0){
- return -1;
- }
- if(exp==0||exp==1){
- return base;
- }
- return base * power(base, exp - 1);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement