Mehmet Ethem SULAN :: Java Recursive Methods :: Recursion Java example(Java ile sayıların toplayan Recursive Metod)
package ethemsulan.com;
public class RecursiveMetod {
//sayıların toplamını alan recusive metod
	 public static int topla(int n){
	  if(n<1)
	  {
	   return 0;
	   }
	  else
	  {
		   return n+topla(n-1);
	    }
	  }
public static void main(String[] args) {
	 System.out.println(topla(100));
	 }
}

Comments

There is one comment for this post.

  1. andymazur on Temmuz 31, 2010 6:41 pm

    I would like to exchange links with your site http://www.ethemsulan.com
    Is this possible?

Write a Comment

Let me know what you think?