package demo; public class Demo { public static int sum(int i){ if(i == 0){ return 0; } if(i > 0){ return i+=sum(i-1); } if(i < 0){ return 0; } return 0; } public static void main(String[] args) { System.out.println(sum(100)); } }