public class Sum { |
|
public static int count( int n) { |
|
if (n > 1 ) { |
return count(n - 1 ) + n; |
} else { |
return n; |
} |
} |
|
public static void main(String[] args) { |
System.out.println(Sum.count( 100 )); |
} |
} |