Mehmet Ethem SULAN :: Java Recursive Methods :: Java ile Recursive olarak üs alan metod(power recursion java example)
package ethemsulan.com;
public class UsAlmaRecursive {
//Eger 1 den kucukse 1 donder yani metodu sonlandir.
//Degilse taban*bir sonraki cagirimdaki taban
	 public static int usAl(int taban,int us){
	  if(us<1)
	  {
	   return 1;
	   }
	  else
	   {
		   return usAl(taban,us-1)*taban;
	    }
	  }
	 public static void main(String[] args) {
	         System.out.println(usAl(4,3));
	 }
}

Write a Comment

Let me know what you think?