Advertisement
cesarnascimento

Untitled

Mar 1st, 2018
122
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.48 KB | None | 0 0
  1. package recursividade;
  2.  
  3. import java.util.Stack;
  4.  
  5. public class recursivo {
  6. public static void main(String[] args) {
  7.     String palavra = "ADA";
  8.     System.out.println(palindrome(palavra));
  9.  
  10. }
  11.    
  12.     public static int fatorial(int num) {
  13.        
  14.         if(num == 0) {
  15.             return 1;
  16.         }
  17.        
  18.         return num * fatorial(num - 1);
  19.        
  20.     }
  21.    
  22.    
  23.     public static int powerN(int base, int expoente) {
  24.         if(expoente == 0) {
  25.             return 1;
  26.         }else {
  27.             return base * powerN(base, expoente -1);
  28.         }
  29.        
  30.        
  31.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement