(PCC)::[How-to-write-Java-Program-to-Find-the-Sum-of-Natural-Numbers-using-Recursion]::[java]
//Example: Sum of Natural Numbers Using Recursion public class AddNumbers { public static void main(String[] args) { int number = 20; int sum = addNumbers(number); System.out.println("Sum = " + sum); } public static int addNumbers(int num) { if (num != 0) return num + addNumbers(num - 1); else return num; } }